1// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved.
2// Code generated. DO NOT EDIT.
3
4// Core Services API
5//
6// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
7// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
8// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
9// to manage resources such as virtual cloud networks (VCNs), compute instances, and
10// block storage volumes.
11//
12
13package core
14
15import (
16	"context"
17	"fmt"
18	"github.com/oracle/oci-go-sdk/common"
19	"net/http"
20)
21
22//ComputeClient a client for Compute
23type ComputeClient struct {
24	common.BaseClient
25	config *common.ConfigurationProvider
26}
27
28// NewComputeClientWithConfigurationProvider Creates a new default Compute client with the given configuration provider.
29// the configuration provider will be used for the default signer as well as reading the region
30func NewComputeClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client ComputeClient, err error) {
31	baseClient, err := common.NewClientWithConfig(configProvider)
32	if err != nil {
33		return
34	}
35
36	client = ComputeClient{BaseClient: baseClient}
37	client.BasePath = "20160918"
38	err = client.setConfigurationProvider(configProvider)
39	return
40}
41
42// SetRegion overrides the region of this client.
43func (client *ComputeClient) SetRegion(region string) {
44	client.Host = common.StringToRegion(region).EndpointForTemplate("iaas", "https://iaas.{region}.{secondLevelDomain}")
45}
46
47// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid
48func (client *ComputeClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error {
49	if ok, err := common.IsConfigurationProviderValid(configProvider); !ok {
50		return err
51	}
52
53	// Error has been checked already
54	region, _ := configProvider.Region()
55	client.SetRegion(region)
56	client.config = &configProvider
57	return nil
58}
59
60// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set
61func (client *ComputeClient) ConfigurationProvider() *common.ConfigurationProvider {
62	return client.config
63}
64
65// AddImageShapeCompatibilityEntry Adds a shape to the compatible shapes list for the image.
66func (client ComputeClient) AddImageShapeCompatibilityEntry(ctx context.Context, request AddImageShapeCompatibilityEntryRequest) (response AddImageShapeCompatibilityEntryResponse, err error) {
67	var ociResponse common.OCIResponse
68	policy := common.NoRetryPolicy()
69	if request.RetryPolicy() != nil {
70		policy = *request.RetryPolicy()
71	}
72	ociResponse, err = common.Retry(ctx, request, client.addImageShapeCompatibilityEntry, policy)
73	if err != nil {
74		if ociResponse != nil {
75			response = AddImageShapeCompatibilityEntryResponse{RawResponse: ociResponse.HTTPResponse()}
76		}
77		return
78	}
79	if convertedResponse, ok := ociResponse.(AddImageShapeCompatibilityEntryResponse); ok {
80		response = convertedResponse
81	} else {
82		err = fmt.Errorf("failed to convert OCIResponse into AddImageShapeCompatibilityEntryResponse")
83	}
84	return
85}
86
87// addImageShapeCompatibilityEntry implements the OCIOperation interface (enables retrying operations)
88func (client ComputeClient) addImageShapeCompatibilityEntry(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
89	httpRequest, err := request.HTTPRequest(http.MethodPut, "/images/{imageId}/shapes/{shapeName}")
90	if err != nil {
91		return nil, err
92	}
93
94	var response AddImageShapeCompatibilityEntryResponse
95	var httpResponse *http.Response
96	httpResponse, err = client.Call(ctx, &httpRequest)
97	defer common.CloseBodyIfValid(httpResponse)
98	response.RawResponse = httpResponse
99	if err != nil {
100		return response, err
101	}
102
103	err = common.UnmarshalResponse(httpResponse, &response)
104	return response, err
105}
106
107// AttachBootVolume Attaches the specified boot volume to the specified instance.
108func (client ComputeClient) AttachBootVolume(ctx context.Context, request AttachBootVolumeRequest) (response AttachBootVolumeResponse, err error) {
109	var ociResponse common.OCIResponse
110	policy := common.NoRetryPolicy()
111	if request.RetryPolicy() != nil {
112		policy = *request.RetryPolicy()
113	}
114
115	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
116		request.OpcRetryToken = common.String(common.RetryToken())
117	}
118
119	ociResponse, err = common.Retry(ctx, request, client.attachBootVolume, policy)
120	if err != nil {
121		if ociResponse != nil {
122			response = AttachBootVolumeResponse{RawResponse: ociResponse.HTTPResponse()}
123		}
124		return
125	}
126	if convertedResponse, ok := ociResponse.(AttachBootVolumeResponse); ok {
127		response = convertedResponse
128	} else {
129		err = fmt.Errorf("failed to convert OCIResponse into AttachBootVolumeResponse")
130	}
131	return
132}
133
134// attachBootVolume implements the OCIOperation interface (enables retrying operations)
135func (client ComputeClient) attachBootVolume(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
136	httpRequest, err := request.HTTPRequest(http.MethodPost, "/bootVolumeAttachments")
137	if err != nil {
138		return nil, err
139	}
140
141	var response AttachBootVolumeResponse
142	var httpResponse *http.Response
143	httpResponse, err = client.Call(ctx, &httpRequest)
144	defer common.CloseBodyIfValid(httpResponse)
145	response.RawResponse = httpResponse
146	if err != nil {
147		return response, err
148	}
149
150	err = common.UnmarshalResponse(httpResponse, &response)
151	return response, err
152}
153
154// AttachVnic Creates a secondary VNIC and attaches it to the specified instance.
155// For more information about secondary VNICs, see
156// Virtual Network Interface Cards (VNICs) (https://docs.cloud.oracle.com/Content/Network/Tasks/managingVNICs.htm).
157func (client ComputeClient) AttachVnic(ctx context.Context, request AttachVnicRequest) (response AttachVnicResponse, err error) {
158	var ociResponse common.OCIResponse
159	policy := common.NoRetryPolicy()
160	if request.RetryPolicy() != nil {
161		policy = *request.RetryPolicy()
162	}
163
164	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
165		request.OpcRetryToken = common.String(common.RetryToken())
166	}
167
168	ociResponse, err = common.Retry(ctx, request, client.attachVnic, policy)
169	if err != nil {
170		if ociResponse != nil {
171			response = AttachVnicResponse{RawResponse: ociResponse.HTTPResponse()}
172		}
173		return
174	}
175	if convertedResponse, ok := ociResponse.(AttachVnicResponse); ok {
176		response = convertedResponse
177	} else {
178		err = fmt.Errorf("failed to convert OCIResponse into AttachVnicResponse")
179	}
180	return
181}
182
183// attachVnic implements the OCIOperation interface (enables retrying operations)
184func (client ComputeClient) attachVnic(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
185	httpRequest, err := request.HTTPRequest(http.MethodPost, "/vnicAttachments")
186	if err != nil {
187		return nil, err
188	}
189
190	var response AttachVnicResponse
191	var httpResponse *http.Response
192	httpResponse, err = client.Call(ctx, &httpRequest)
193	defer common.CloseBodyIfValid(httpResponse)
194	response.RawResponse = httpResponse
195	if err != nil {
196		return response, err
197	}
198
199	err = common.UnmarshalResponse(httpResponse, &response)
200	return response, err
201}
202
203// AttachVolume Attaches the specified storage volume to the specified instance.
204func (client ComputeClient) AttachVolume(ctx context.Context, request AttachVolumeRequest) (response AttachVolumeResponse, err error) {
205	var ociResponse common.OCIResponse
206	policy := common.NoRetryPolicy()
207	if request.RetryPolicy() != nil {
208		policy = *request.RetryPolicy()
209	}
210
211	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
212		request.OpcRetryToken = common.String(common.RetryToken())
213	}
214
215	ociResponse, err = common.Retry(ctx, request, client.attachVolume, policy)
216	if err != nil {
217		if ociResponse != nil {
218			response = AttachVolumeResponse{RawResponse: ociResponse.HTTPResponse()}
219		}
220		return
221	}
222	if convertedResponse, ok := ociResponse.(AttachVolumeResponse); ok {
223		response = convertedResponse
224	} else {
225		err = fmt.Errorf("failed to convert OCIResponse into AttachVolumeResponse")
226	}
227	return
228}
229
230// attachVolume implements the OCIOperation interface (enables retrying operations)
231func (client ComputeClient) attachVolume(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
232	httpRequest, err := request.HTTPRequest(http.MethodPost, "/volumeAttachments")
233	if err != nil {
234		return nil, err
235	}
236
237	var response AttachVolumeResponse
238	var httpResponse *http.Response
239	httpResponse, err = client.Call(ctx, &httpRequest)
240	defer common.CloseBodyIfValid(httpResponse)
241	response.RawResponse = httpResponse
242	if err != nil {
243		return response, err
244	}
245
246	err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &volumeattachment{})
247	return response, err
248}
249
250// CaptureConsoleHistory Captures the most recent serial console data (up to a megabyte) for the
251// specified instance.
252// The `CaptureConsoleHistory` operation works with the other console history operations
253// as described below.
254// 1. Use `CaptureConsoleHistory` to request the capture of up to a megabyte of the
255// most recent console history. This call returns a `ConsoleHistory`
256// object. The object will have a state of REQUESTED.
257// 2. Wait for the capture operation to succeed by polling `GetConsoleHistory` with
258// the identifier of the console history metadata. The state of the
259// `ConsoleHistory` object will go from REQUESTED to GETTING-HISTORY and
260// then SUCCEEDED (or FAILED).
261// 3. Use `GetConsoleHistoryContent` to get the actual console history data (not the
262// metadata).
263// 4. Optionally, use `DeleteConsoleHistory` to delete the console history metadata
264// and the console history data.
265func (client ComputeClient) CaptureConsoleHistory(ctx context.Context, request CaptureConsoleHistoryRequest) (response CaptureConsoleHistoryResponse, err error) {
266	var ociResponse common.OCIResponse
267	policy := common.NoRetryPolicy()
268	if request.RetryPolicy() != nil {
269		policy = *request.RetryPolicy()
270	}
271
272	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
273		request.OpcRetryToken = common.String(common.RetryToken())
274	}
275
276	ociResponse, err = common.Retry(ctx, request, client.captureConsoleHistory, policy)
277	if err != nil {
278		if ociResponse != nil {
279			response = CaptureConsoleHistoryResponse{RawResponse: ociResponse.HTTPResponse()}
280		}
281		return
282	}
283	if convertedResponse, ok := ociResponse.(CaptureConsoleHistoryResponse); ok {
284		response = convertedResponse
285	} else {
286		err = fmt.Errorf("failed to convert OCIResponse into CaptureConsoleHistoryResponse")
287	}
288	return
289}
290
291// captureConsoleHistory implements the OCIOperation interface (enables retrying operations)
292func (client ComputeClient) captureConsoleHistory(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
293	httpRequest, err := request.HTTPRequest(http.MethodPost, "/instanceConsoleHistories")
294	if err != nil {
295		return nil, err
296	}
297
298	var response CaptureConsoleHistoryResponse
299	var httpResponse *http.Response
300	httpResponse, err = client.Call(ctx, &httpRequest)
301	defer common.CloseBodyIfValid(httpResponse)
302	response.RawResponse = httpResponse
303	if err != nil {
304		return response, err
305	}
306
307	err = common.UnmarshalResponse(httpResponse, &response)
308	return response, err
309}
310
311// ChangeDedicatedVmHostCompartment Moves a dedicated virtual machine host from one compartment to another.
312func (client ComputeClient) ChangeDedicatedVmHostCompartment(ctx context.Context, request ChangeDedicatedVmHostCompartmentRequest) (response ChangeDedicatedVmHostCompartmentResponse, err error) {
313	var ociResponse common.OCIResponse
314	policy := common.NoRetryPolicy()
315	if request.RetryPolicy() != nil {
316		policy = *request.RetryPolicy()
317	}
318
319	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
320		request.OpcRetryToken = common.String(common.RetryToken())
321	}
322
323	ociResponse, err = common.Retry(ctx, request, client.changeDedicatedVmHostCompartment, policy)
324	if err != nil {
325		if ociResponse != nil {
326			response = ChangeDedicatedVmHostCompartmentResponse{RawResponse: ociResponse.HTTPResponse()}
327		}
328		return
329	}
330	if convertedResponse, ok := ociResponse.(ChangeDedicatedVmHostCompartmentResponse); ok {
331		response = convertedResponse
332	} else {
333		err = fmt.Errorf("failed to convert OCIResponse into ChangeDedicatedVmHostCompartmentResponse")
334	}
335	return
336}
337
338// changeDedicatedVmHostCompartment implements the OCIOperation interface (enables retrying operations)
339func (client ComputeClient) changeDedicatedVmHostCompartment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
340	httpRequest, err := request.HTTPRequest(http.MethodPost, "/dedicatedVmHosts/{dedicatedVmHostId}/actions/changeCompartment")
341	if err != nil {
342		return nil, err
343	}
344
345	var response ChangeDedicatedVmHostCompartmentResponse
346	var httpResponse *http.Response
347	httpResponse, err = client.Call(ctx, &httpRequest)
348	defer common.CloseBodyIfValid(httpResponse)
349	response.RawResponse = httpResponse
350	if err != nil {
351		return response, err
352	}
353
354	err = common.UnmarshalResponse(httpResponse, &response)
355	return response, err
356}
357
358// ChangeImageCompartment Moves an image into a different compartment within the same tenancy. For information about moving
359// resources between compartments, see
360// Moving Resources to a Different Compartment (https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes).
361func (client ComputeClient) ChangeImageCompartment(ctx context.Context, request ChangeImageCompartmentRequest) (response ChangeImageCompartmentResponse, err error) {
362	var ociResponse common.OCIResponse
363	policy := common.NoRetryPolicy()
364	if request.RetryPolicy() != nil {
365		policy = *request.RetryPolicy()
366	}
367
368	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
369		request.OpcRetryToken = common.String(common.RetryToken())
370	}
371
372	ociResponse, err = common.Retry(ctx, request, client.changeImageCompartment, policy)
373	if err != nil {
374		if ociResponse != nil {
375			response = ChangeImageCompartmentResponse{RawResponse: ociResponse.HTTPResponse()}
376		}
377		return
378	}
379	if convertedResponse, ok := ociResponse.(ChangeImageCompartmentResponse); ok {
380		response = convertedResponse
381	} else {
382		err = fmt.Errorf("failed to convert OCIResponse into ChangeImageCompartmentResponse")
383	}
384	return
385}
386
387// changeImageCompartment implements the OCIOperation interface (enables retrying operations)
388func (client ComputeClient) changeImageCompartment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
389	httpRequest, err := request.HTTPRequest(http.MethodPost, "/images/{imageId}/actions/changeCompartment")
390	if err != nil {
391		return nil, err
392	}
393
394	var response ChangeImageCompartmentResponse
395	var httpResponse *http.Response
396	httpResponse, err = client.Call(ctx, &httpRequest)
397	defer common.CloseBodyIfValid(httpResponse)
398	response.RawResponse = httpResponse
399	if err != nil {
400		return response, err
401	}
402
403	err = common.UnmarshalResponse(httpResponse, &response)
404	return response, err
405}
406
407// ChangeInstanceCompartment Moves an instance into a different compartment within the same tenancy. For information about
408// moving resources between compartments, see
409// Moving Resources to a Different Compartment (https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes).
410// When you move an instance to a different compartment, associated resources such as boot volumes and VNICs
411// are not moved.
412func (client ComputeClient) ChangeInstanceCompartment(ctx context.Context, request ChangeInstanceCompartmentRequest) (response ChangeInstanceCompartmentResponse, err error) {
413	var ociResponse common.OCIResponse
414	policy := common.NoRetryPolicy()
415	if request.RetryPolicy() != nil {
416		policy = *request.RetryPolicy()
417	}
418
419	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
420		request.OpcRetryToken = common.String(common.RetryToken())
421	}
422
423	ociResponse, err = common.Retry(ctx, request, client.changeInstanceCompartment, policy)
424	if err != nil {
425		if ociResponse != nil {
426			response = ChangeInstanceCompartmentResponse{RawResponse: ociResponse.HTTPResponse()}
427		}
428		return
429	}
430	if convertedResponse, ok := ociResponse.(ChangeInstanceCompartmentResponse); ok {
431		response = convertedResponse
432	} else {
433		err = fmt.Errorf("failed to convert OCIResponse into ChangeInstanceCompartmentResponse")
434	}
435	return
436}
437
438// changeInstanceCompartment implements the OCIOperation interface (enables retrying operations)
439func (client ComputeClient) changeInstanceCompartment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
440	httpRequest, err := request.HTTPRequest(http.MethodPost, "/instances/{instanceId}/actions/changeCompartment")
441	if err != nil {
442		return nil, err
443	}
444
445	var response ChangeInstanceCompartmentResponse
446	var httpResponse *http.Response
447	httpResponse, err = client.Call(ctx, &httpRequest)
448	defer common.CloseBodyIfValid(httpResponse)
449	response.RawResponse = httpResponse
450	if err != nil {
451		return response, err
452	}
453
454	err = common.UnmarshalResponse(httpResponse, &response)
455	return response, err
456}
457
458// CreateAppCatalogSubscription Create a subscription for listing resource version for a compartment. It will take some time to propagate to all regions.
459func (client ComputeClient) CreateAppCatalogSubscription(ctx context.Context, request CreateAppCatalogSubscriptionRequest) (response CreateAppCatalogSubscriptionResponse, err error) {
460	var ociResponse common.OCIResponse
461	policy := common.NoRetryPolicy()
462	if request.RetryPolicy() != nil {
463		policy = *request.RetryPolicy()
464	}
465
466	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
467		request.OpcRetryToken = common.String(common.RetryToken())
468	}
469
470	ociResponse, err = common.Retry(ctx, request, client.createAppCatalogSubscription, policy)
471	if err != nil {
472		if ociResponse != nil {
473			response = CreateAppCatalogSubscriptionResponse{RawResponse: ociResponse.HTTPResponse()}
474		}
475		return
476	}
477	if convertedResponse, ok := ociResponse.(CreateAppCatalogSubscriptionResponse); ok {
478		response = convertedResponse
479	} else {
480		err = fmt.Errorf("failed to convert OCIResponse into CreateAppCatalogSubscriptionResponse")
481	}
482	return
483}
484
485// createAppCatalogSubscription implements the OCIOperation interface (enables retrying operations)
486func (client ComputeClient) createAppCatalogSubscription(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
487	httpRequest, err := request.HTTPRequest(http.MethodPost, "/appCatalogSubscriptions")
488	if err != nil {
489		return nil, err
490	}
491
492	var response CreateAppCatalogSubscriptionResponse
493	var httpResponse *http.Response
494	httpResponse, err = client.Call(ctx, &httpRequest)
495	defer common.CloseBodyIfValid(httpResponse)
496	response.RawResponse = httpResponse
497	if err != nil {
498		return response, err
499	}
500
501	err = common.UnmarshalResponse(httpResponse, &response)
502	return response, err
503}
504
505// CreateDedicatedVmHost Creates a new dedicated virtual machine host in the specified compartment and the specified availability domain.
506// Dedicated virtual machine hosts enable you to run your Compute virtual machine (VM) instances on dedicated servers
507// that are a single tenant and not shared with other customers.
508// For more information, see Dedicated Virtual Machine Hosts (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/dedicatedvmhosts.htm).
509func (client ComputeClient) CreateDedicatedVmHost(ctx context.Context, request CreateDedicatedVmHostRequest) (response CreateDedicatedVmHostResponse, err error) {
510	var ociResponse common.OCIResponse
511	policy := common.NoRetryPolicy()
512	if request.RetryPolicy() != nil {
513		policy = *request.RetryPolicy()
514	}
515
516	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
517		request.OpcRetryToken = common.String(common.RetryToken())
518	}
519
520	ociResponse, err = common.Retry(ctx, request, client.createDedicatedVmHost, policy)
521	if err != nil {
522		if ociResponse != nil {
523			response = CreateDedicatedVmHostResponse{RawResponse: ociResponse.HTTPResponse()}
524		}
525		return
526	}
527	if convertedResponse, ok := ociResponse.(CreateDedicatedVmHostResponse); ok {
528		response = convertedResponse
529	} else {
530		err = fmt.Errorf("failed to convert OCIResponse into CreateDedicatedVmHostResponse")
531	}
532	return
533}
534
535// createDedicatedVmHost implements the OCIOperation interface (enables retrying operations)
536func (client ComputeClient) createDedicatedVmHost(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
537	httpRequest, err := request.HTTPRequest(http.MethodPost, "/dedicatedVmHosts")
538	if err != nil {
539		return nil, err
540	}
541
542	var response CreateDedicatedVmHostResponse
543	var httpResponse *http.Response
544	httpResponse, err = client.Call(ctx, &httpRequest)
545	defer common.CloseBodyIfValid(httpResponse)
546	response.RawResponse = httpResponse
547	if err != nil {
548		return response, err
549	}
550
551	err = common.UnmarshalResponse(httpResponse, &response)
552	return response, err
553}
554
555// CreateImage Creates a boot disk image for the specified instance or imports an exported image from the Oracle Cloud Infrastructure Object Storage service.
556// When creating a new image, you must provide the OCID of the instance you want to use as the basis for the image, and
557// the OCID of the compartment containing that instance. For more information about images,
558// see Managing Custom Images (https://docs.cloud.oracle.com/Content/Compute/Tasks/managingcustomimages.htm).
559// When importing an exported image from Object Storage, you specify the source information
560// in ImageSourceDetails.
561// When importing an image based on the namespace, bucket name, and object name,
562// use ImageSourceViaObjectStorageTupleDetails.
563// When importing an image based on the Object Storage URL, use
564// ImageSourceViaObjectStorageUriDetails.
565// See Object Storage URLs (https://docs.cloud.oracle.com/Content/Compute/Tasks/imageimportexport.htm#URLs) and Using Pre-Authenticated Requests (https://docs.cloud.oracle.com/Content/Object/Tasks/usingpreauthenticatedrequests.htm)
566// for constructing URLs for image import/export.
567// For more information about importing exported images, see
568// Image Import/Export (https://docs.cloud.oracle.com/Content/Compute/Tasks/imageimportexport.htm).
569// You may optionally specify a *display name* for the image, which is simply a friendly name or description.
570// It does not have to be unique, and you can change it. See UpdateImage.
571// Avoid entering confidential information.
572func (client ComputeClient) CreateImage(ctx context.Context, request CreateImageRequest) (response CreateImageResponse, err error) {
573	var ociResponse common.OCIResponse
574	policy := common.NoRetryPolicy()
575	if request.RetryPolicy() != nil {
576		policy = *request.RetryPolicy()
577	}
578
579	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
580		request.OpcRetryToken = common.String(common.RetryToken())
581	}
582
583	ociResponse, err = common.Retry(ctx, request, client.createImage, policy)
584	if err != nil {
585		if ociResponse != nil {
586			response = CreateImageResponse{RawResponse: ociResponse.HTTPResponse()}
587		}
588		return
589	}
590	if convertedResponse, ok := ociResponse.(CreateImageResponse); ok {
591		response = convertedResponse
592	} else {
593		err = fmt.Errorf("failed to convert OCIResponse into CreateImageResponse")
594	}
595	return
596}
597
598// createImage implements the OCIOperation interface (enables retrying operations)
599func (client ComputeClient) createImage(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
600	httpRequest, err := request.HTTPRequest(http.MethodPost, "/images")
601	if err != nil {
602		return nil, err
603	}
604
605	var response CreateImageResponse
606	var httpResponse *http.Response
607	httpResponse, err = client.Call(ctx, &httpRequest)
608	defer common.CloseBodyIfValid(httpResponse)
609	response.RawResponse = httpResponse
610	if err != nil {
611		return response, err
612	}
613
614	err = common.UnmarshalResponse(httpResponse, &response)
615	return response, err
616}
617
618// CreateInstanceConsoleConnection Creates a new console connection to the specified instance.
619// After the console connection has been created and is available,
620// you connect to the console using SSH.
621// For more information about console access, see Accessing the Console (https://docs.cloud.oracle.com/Content/Compute/References/serialconsole.htm).
622func (client ComputeClient) CreateInstanceConsoleConnection(ctx context.Context, request CreateInstanceConsoleConnectionRequest) (response CreateInstanceConsoleConnectionResponse, err error) {
623	var ociResponse common.OCIResponse
624	policy := common.NoRetryPolicy()
625	if request.RetryPolicy() != nil {
626		policy = *request.RetryPolicy()
627	}
628
629	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
630		request.OpcRetryToken = common.String(common.RetryToken())
631	}
632
633	ociResponse, err = common.Retry(ctx, request, client.createInstanceConsoleConnection, policy)
634	if err != nil {
635		if ociResponse != nil {
636			response = CreateInstanceConsoleConnectionResponse{RawResponse: ociResponse.HTTPResponse()}
637		}
638		return
639	}
640	if convertedResponse, ok := ociResponse.(CreateInstanceConsoleConnectionResponse); ok {
641		response = convertedResponse
642	} else {
643		err = fmt.Errorf("failed to convert OCIResponse into CreateInstanceConsoleConnectionResponse")
644	}
645	return
646}
647
648// createInstanceConsoleConnection implements the OCIOperation interface (enables retrying operations)
649func (client ComputeClient) createInstanceConsoleConnection(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
650	httpRequest, err := request.HTTPRequest(http.MethodPost, "/instanceConsoleConnections")
651	if err != nil {
652		return nil, err
653	}
654
655	var response CreateInstanceConsoleConnectionResponse
656	var httpResponse *http.Response
657	httpResponse, err = client.Call(ctx, &httpRequest)
658	defer common.CloseBodyIfValid(httpResponse)
659	response.RawResponse = httpResponse
660	if err != nil {
661		return response, err
662	}
663
664	err = common.UnmarshalResponse(httpResponse, &response)
665	return response, err
666}
667
668// DeleteAppCatalogSubscription Delete a subscription for a listing resource version for a compartment.
669func (client ComputeClient) DeleteAppCatalogSubscription(ctx context.Context, request DeleteAppCatalogSubscriptionRequest) (response DeleteAppCatalogSubscriptionResponse, err error) {
670	var ociResponse common.OCIResponse
671	policy := common.NoRetryPolicy()
672	if request.RetryPolicy() != nil {
673		policy = *request.RetryPolicy()
674	}
675	ociResponse, err = common.Retry(ctx, request, client.deleteAppCatalogSubscription, policy)
676	if err != nil {
677		if ociResponse != nil {
678			response = DeleteAppCatalogSubscriptionResponse{RawResponse: ociResponse.HTTPResponse()}
679		}
680		return
681	}
682	if convertedResponse, ok := ociResponse.(DeleteAppCatalogSubscriptionResponse); ok {
683		response = convertedResponse
684	} else {
685		err = fmt.Errorf("failed to convert OCIResponse into DeleteAppCatalogSubscriptionResponse")
686	}
687	return
688}
689
690// deleteAppCatalogSubscription implements the OCIOperation interface (enables retrying operations)
691func (client ComputeClient) deleteAppCatalogSubscription(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
692	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/appCatalogSubscriptions")
693	if err != nil {
694		return nil, err
695	}
696
697	var response DeleteAppCatalogSubscriptionResponse
698	var httpResponse *http.Response
699	httpResponse, err = client.Call(ctx, &httpRequest)
700	defer common.CloseBodyIfValid(httpResponse)
701	response.RawResponse = httpResponse
702	if err != nil {
703		return response, err
704	}
705
706	err = common.UnmarshalResponse(httpResponse, &response)
707	return response, err
708}
709
710// DeleteConsoleHistory Deletes the specified console history metadata and the console history data.
711func (client ComputeClient) DeleteConsoleHistory(ctx context.Context, request DeleteConsoleHistoryRequest) (response DeleteConsoleHistoryResponse, err error) {
712	var ociResponse common.OCIResponse
713	policy := common.NoRetryPolicy()
714	if request.RetryPolicy() != nil {
715		policy = *request.RetryPolicy()
716	}
717	ociResponse, err = common.Retry(ctx, request, client.deleteConsoleHistory, policy)
718	if err != nil {
719		if ociResponse != nil {
720			response = DeleteConsoleHistoryResponse{RawResponse: ociResponse.HTTPResponse()}
721		}
722		return
723	}
724	if convertedResponse, ok := ociResponse.(DeleteConsoleHistoryResponse); ok {
725		response = convertedResponse
726	} else {
727		err = fmt.Errorf("failed to convert OCIResponse into DeleteConsoleHistoryResponse")
728	}
729	return
730}
731
732// deleteConsoleHistory implements the OCIOperation interface (enables retrying operations)
733func (client ComputeClient) deleteConsoleHistory(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
734	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/instanceConsoleHistories/{instanceConsoleHistoryId}")
735	if err != nil {
736		return nil, err
737	}
738
739	var response DeleteConsoleHistoryResponse
740	var httpResponse *http.Response
741	httpResponse, err = client.Call(ctx, &httpRequest)
742	defer common.CloseBodyIfValid(httpResponse)
743	response.RawResponse = httpResponse
744	if err != nil {
745		return response, err
746	}
747
748	err = common.UnmarshalResponse(httpResponse, &response)
749	return response, err
750}
751
752// DeleteDedicatedVmHost Deletes the specified dedicated virtual machine host.
753// If any VM instances are assigned to the dedicated virtual machine host,
754// the delete operation will fail and the service will return a 409 response code.
755func (client ComputeClient) DeleteDedicatedVmHost(ctx context.Context, request DeleteDedicatedVmHostRequest) (response DeleteDedicatedVmHostResponse, err error) {
756	var ociResponse common.OCIResponse
757	policy := common.NoRetryPolicy()
758	if request.RetryPolicy() != nil {
759		policy = *request.RetryPolicy()
760	}
761	ociResponse, err = common.Retry(ctx, request, client.deleteDedicatedVmHost, policy)
762	if err != nil {
763		if ociResponse != nil {
764			response = DeleteDedicatedVmHostResponse{RawResponse: ociResponse.HTTPResponse()}
765		}
766		return
767	}
768	if convertedResponse, ok := ociResponse.(DeleteDedicatedVmHostResponse); ok {
769		response = convertedResponse
770	} else {
771		err = fmt.Errorf("failed to convert OCIResponse into DeleteDedicatedVmHostResponse")
772	}
773	return
774}
775
776// deleteDedicatedVmHost implements the OCIOperation interface (enables retrying operations)
777func (client ComputeClient) deleteDedicatedVmHost(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
778	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/dedicatedVmHosts/{dedicatedVmHostId}")
779	if err != nil {
780		return nil, err
781	}
782
783	var response DeleteDedicatedVmHostResponse
784	var httpResponse *http.Response
785	httpResponse, err = client.Call(ctx, &httpRequest)
786	defer common.CloseBodyIfValid(httpResponse)
787	response.RawResponse = httpResponse
788	if err != nil {
789		return response, err
790	}
791
792	err = common.UnmarshalResponse(httpResponse, &response)
793	return response, err
794}
795
796// DeleteImage Deletes an image.
797func (client ComputeClient) DeleteImage(ctx context.Context, request DeleteImageRequest) (response DeleteImageResponse, err error) {
798	var ociResponse common.OCIResponse
799	policy := common.NoRetryPolicy()
800	if request.RetryPolicy() != nil {
801		policy = *request.RetryPolicy()
802	}
803	ociResponse, err = common.Retry(ctx, request, client.deleteImage, policy)
804	if err != nil {
805		if ociResponse != nil {
806			response = DeleteImageResponse{RawResponse: ociResponse.HTTPResponse()}
807		}
808		return
809	}
810	if convertedResponse, ok := ociResponse.(DeleteImageResponse); ok {
811		response = convertedResponse
812	} else {
813		err = fmt.Errorf("failed to convert OCIResponse into DeleteImageResponse")
814	}
815	return
816}
817
818// deleteImage implements the OCIOperation interface (enables retrying operations)
819func (client ComputeClient) deleteImage(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
820	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/images/{imageId}")
821	if err != nil {
822		return nil, err
823	}
824
825	var response DeleteImageResponse
826	var httpResponse *http.Response
827	httpResponse, err = client.Call(ctx, &httpRequest)
828	defer common.CloseBodyIfValid(httpResponse)
829	response.RawResponse = httpResponse
830	if err != nil {
831		return response, err
832	}
833
834	err = common.UnmarshalResponse(httpResponse, &response)
835	return response, err
836}
837
838// DeleteInstanceConsoleConnection Deletes the specified instance console connection.
839func (client ComputeClient) DeleteInstanceConsoleConnection(ctx context.Context, request DeleteInstanceConsoleConnectionRequest) (response DeleteInstanceConsoleConnectionResponse, err error) {
840	var ociResponse common.OCIResponse
841	policy := common.NoRetryPolicy()
842	if request.RetryPolicy() != nil {
843		policy = *request.RetryPolicy()
844	}
845	ociResponse, err = common.Retry(ctx, request, client.deleteInstanceConsoleConnection, policy)
846	if err != nil {
847		if ociResponse != nil {
848			response = DeleteInstanceConsoleConnectionResponse{RawResponse: ociResponse.HTTPResponse()}
849		}
850		return
851	}
852	if convertedResponse, ok := ociResponse.(DeleteInstanceConsoleConnectionResponse); ok {
853		response = convertedResponse
854	} else {
855		err = fmt.Errorf("failed to convert OCIResponse into DeleteInstanceConsoleConnectionResponse")
856	}
857	return
858}
859
860// deleteInstanceConsoleConnection implements the OCIOperation interface (enables retrying operations)
861func (client ComputeClient) deleteInstanceConsoleConnection(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
862	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/instanceConsoleConnections/{instanceConsoleConnectionId}")
863	if err != nil {
864		return nil, err
865	}
866
867	var response DeleteInstanceConsoleConnectionResponse
868	var httpResponse *http.Response
869	httpResponse, err = client.Call(ctx, &httpRequest)
870	defer common.CloseBodyIfValid(httpResponse)
871	response.RawResponse = httpResponse
872	if err != nil {
873		return response, err
874	}
875
876	err = common.UnmarshalResponse(httpResponse, &response)
877	return response, err
878}
879
880// DetachBootVolume Detaches a boot volume from an instance. You must specify the OCID of the boot volume attachment.
881// This is an asynchronous operation. The attachment's `lifecycleState` will change to DETACHING temporarily
882// until the attachment is completely removed.
883func (client ComputeClient) DetachBootVolume(ctx context.Context, request DetachBootVolumeRequest) (response DetachBootVolumeResponse, err error) {
884	var ociResponse common.OCIResponse
885	policy := common.NoRetryPolicy()
886	if request.RetryPolicy() != nil {
887		policy = *request.RetryPolicy()
888	}
889	ociResponse, err = common.Retry(ctx, request, client.detachBootVolume, policy)
890	if err != nil {
891		if ociResponse != nil {
892			response = DetachBootVolumeResponse{RawResponse: ociResponse.HTTPResponse()}
893		}
894		return
895	}
896	if convertedResponse, ok := ociResponse.(DetachBootVolumeResponse); ok {
897		response = convertedResponse
898	} else {
899		err = fmt.Errorf("failed to convert OCIResponse into DetachBootVolumeResponse")
900	}
901	return
902}
903
904// detachBootVolume implements the OCIOperation interface (enables retrying operations)
905func (client ComputeClient) detachBootVolume(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
906	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/bootVolumeAttachments/{bootVolumeAttachmentId}")
907	if err != nil {
908		return nil, err
909	}
910
911	var response DetachBootVolumeResponse
912	var httpResponse *http.Response
913	httpResponse, err = client.Call(ctx, &httpRequest)
914	defer common.CloseBodyIfValid(httpResponse)
915	response.RawResponse = httpResponse
916	if err != nil {
917		return response, err
918	}
919
920	err = common.UnmarshalResponse(httpResponse, &response)
921	return response, err
922}
923
924// DetachVnic Detaches and deletes the specified secondary VNIC.
925// This operation cannot be used on the instance's primary VNIC.
926// When you terminate an instance, all attached VNICs (primary
927// and secondary) are automatically detached and deleted.
928// **Important:** If the VNIC has a
929// PrivateIp that is the
930// target of a route rule (https://docs.cloud.oracle.com/Content/Network/Tasks/managingroutetables.htm#privateip),
931// deleting the VNIC causes that route rule to blackhole and the traffic
932// will be dropped.
933func (client ComputeClient) DetachVnic(ctx context.Context, request DetachVnicRequest) (response DetachVnicResponse, err error) {
934	var ociResponse common.OCIResponse
935	policy := common.NoRetryPolicy()
936	if request.RetryPolicy() != nil {
937		policy = *request.RetryPolicy()
938	}
939	ociResponse, err = common.Retry(ctx, request, client.detachVnic, policy)
940	if err != nil {
941		if ociResponse != nil {
942			response = DetachVnicResponse{RawResponse: ociResponse.HTTPResponse()}
943		}
944		return
945	}
946	if convertedResponse, ok := ociResponse.(DetachVnicResponse); ok {
947		response = convertedResponse
948	} else {
949		err = fmt.Errorf("failed to convert OCIResponse into DetachVnicResponse")
950	}
951	return
952}
953
954// detachVnic implements the OCIOperation interface (enables retrying operations)
955func (client ComputeClient) detachVnic(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
956	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/vnicAttachments/{vnicAttachmentId}")
957	if err != nil {
958		return nil, err
959	}
960
961	var response DetachVnicResponse
962	var httpResponse *http.Response
963	httpResponse, err = client.Call(ctx, &httpRequest)
964	defer common.CloseBodyIfValid(httpResponse)
965	response.RawResponse = httpResponse
966	if err != nil {
967		return response, err
968	}
969
970	err = common.UnmarshalResponse(httpResponse, &response)
971	return response, err
972}
973
974// DetachVolume Detaches a storage volume from an instance. You must specify the OCID of the volume attachment.
975// This is an asynchronous operation. The attachment's `lifecycleState` will change to DETACHING temporarily
976// until the attachment is completely removed.
977func (client ComputeClient) DetachVolume(ctx context.Context, request DetachVolumeRequest) (response DetachVolumeResponse, err error) {
978	var ociResponse common.OCIResponse
979	policy := common.NoRetryPolicy()
980	if request.RetryPolicy() != nil {
981		policy = *request.RetryPolicy()
982	}
983	ociResponse, err = common.Retry(ctx, request, client.detachVolume, policy)
984	if err != nil {
985		if ociResponse != nil {
986			response = DetachVolumeResponse{RawResponse: ociResponse.HTTPResponse()}
987		}
988		return
989	}
990	if convertedResponse, ok := ociResponse.(DetachVolumeResponse); ok {
991		response = convertedResponse
992	} else {
993		err = fmt.Errorf("failed to convert OCIResponse into DetachVolumeResponse")
994	}
995	return
996}
997
998// detachVolume implements the OCIOperation interface (enables retrying operations)
999func (client ComputeClient) detachVolume(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1000	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/volumeAttachments/{volumeAttachmentId}")
1001	if err != nil {
1002		return nil, err
1003	}
1004
1005	var response DetachVolumeResponse
1006	var httpResponse *http.Response
1007	httpResponse, err = client.Call(ctx, &httpRequest)
1008	defer common.CloseBodyIfValid(httpResponse)
1009	response.RawResponse = httpResponse
1010	if err != nil {
1011		return response, err
1012	}
1013
1014	err = common.UnmarshalResponse(httpResponse, &response)
1015	return response, err
1016}
1017
1018// ExportImage Exports the specified image to the Oracle Cloud Infrastructure Object Storage service. You can use the Object Storage URL,
1019// or the namespace, bucket name, and object name when specifying the location to export to.
1020// For more information about exporting images, see Image Import/Export (https://docs.cloud.oracle.com/Content/Compute/Tasks/imageimportexport.htm).
1021// To perform an image export, you need write access to the Object Storage bucket for the image,
1022// see Let Users Write Objects to Object Storage Buckets (https://docs.cloud.oracle.com/Content/Identity/Concepts/commonpolicies.htm#Let4).
1023// See Object Storage URLs (https://docs.cloud.oracle.com/Content/Compute/Tasks/imageimportexport.htm#URLs) and Using Pre-Authenticated Requests (https://docs.cloud.oracle.com/Content/Object/Tasks/usingpreauthenticatedrequests.htm)
1024// for constructing URLs for image import/export.
1025func (client ComputeClient) ExportImage(ctx context.Context, request ExportImageRequest) (response ExportImageResponse, err error) {
1026	var ociResponse common.OCIResponse
1027	policy := common.NoRetryPolicy()
1028	if request.RetryPolicy() != nil {
1029		policy = *request.RetryPolicy()
1030	}
1031
1032	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
1033		request.OpcRetryToken = common.String(common.RetryToken())
1034	}
1035
1036	ociResponse, err = common.Retry(ctx, request, client.exportImage, policy)
1037	if err != nil {
1038		if ociResponse != nil {
1039			response = ExportImageResponse{RawResponse: ociResponse.HTTPResponse()}
1040		}
1041		return
1042	}
1043	if convertedResponse, ok := ociResponse.(ExportImageResponse); ok {
1044		response = convertedResponse
1045	} else {
1046		err = fmt.Errorf("failed to convert OCIResponse into ExportImageResponse")
1047	}
1048	return
1049}
1050
1051// exportImage implements the OCIOperation interface (enables retrying operations)
1052func (client ComputeClient) exportImage(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1053	httpRequest, err := request.HTTPRequest(http.MethodPost, "/images/{imageId}/actions/export")
1054	if err != nil {
1055		return nil, err
1056	}
1057
1058	var response ExportImageResponse
1059	var httpResponse *http.Response
1060	httpResponse, err = client.Call(ctx, &httpRequest)
1061	defer common.CloseBodyIfValid(httpResponse)
1062	response.RawResponse = httpResponse
1063	if err != nil {
1064		return response, err
1065	}
1066
1067	err = common.UnmarshalResponse(httpResponse, &response)
1068	return response, err
1069}
1070
1071// GetAppCatalogListing Gets the specified listing.
1072func (client ComputeClient) GetAppCatalogListing(ctx context.Context, request GetAppCatalogListingRequest) (response GetAppCatalogListingResponse, err error) {
1073	var ociResponse common.OCIResponse
1074	policy := common.NoRetryPolicy()
1075	if request.RetryPolicy() != nil {
1076		policy = *request.RetryPolicy()
1077	}
1078	ociResponse, err = common.Retry(ctx, request, client.getAppCatalogListing, policy)
1079	if err != nil {
1080		if ociResponse != nil {
1081			response = GetAppCatalogListingResponse{RawResponse: ociResponse.HTTPResponse()}
1082		}
1083		return
1084	}
1085	if convertedResponse, ok := ociResponse.(GetAppCatalogListingResponse); ok {
1086		response = convertedResponse
1087	} else {
1088		err = fmt.Errorf("failed to convert OCIResponse into GetAppCatalogListingResponse")
1089	}
1090	return
1091}
1092
1093// getAppCatalogListing implements the OCIOperation interface (enables retrying operations)
1094func (client ComputeClient) getAppCatalogListing(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1095	httpRequest, err := request.HTTPRequest(http.MethodGet, "/appCatalogListings/{listingId}")
1096	if err != nil {
1097		return nil, err
1098	}
1099
1100	var response GetAppCatalogListingResponse
1101	var httpResponse *http.Response
1102	httpResponse, err = client.Call(ctx, &httpRequest)
1103	defer common.CloseBodyIfValid(httpResponse)
1104	response.RawResponse = httpResponse
1105	if err != nil {
1106		return response, err
1107	}
1108
1109	err = common.UnmarshalResponse(httpResponse, &response)
1110	return response, err
1111}
1112
1113// GetAppCatalogListingAgreements Retrieves the agreements for a particular resource version of a listing.
1114func (client ComputeClient) GetAppCatalogListingAgreements(ctx context.Context, request GetAppCatalogListingAgreementsRequest) (response GetAppCatalogListingAgreementsResponse, err error) {
1115	var ociResponse common.OCIResponse
1116	policy := common.NoRetryPolicy()
1117	if request.RetryPolicy() != nil {
1118		policy = *request.RetryPolicy()
1119	}
1120	ociResponse, err = common.Retry(ctx, request, client.getAppCatalogListingAgreements, policy)
1121	if err != nil {
1122		if ociResponse != nil {
1123			response = GetAppCatalogListingAgreementsResponse{RawResponse: ociResponse.HTTPResponse()}
1124		}
1125		return
1126	}
1127	if convertedResponse, ok := ociResponse.(GetAppCatalogListingAgreementsResponse); ok {
1128		response = convertedResponse
1129	} else {
1130		err = fmt.Errorf("failed to convert OCIResponse into GetAppCatalogListingAgreementsResponse")
1131	}
1132	return
1133}
1134
1135// getAppCatalogListingAgreements implements the OCIOperation interface (enables retrying operations)
1136func (client ComputeClient) getAppCatalogListingAgreements(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1137	httpRequest, err := request.HTTPRequest(http.MethodGet, "/appCatalogListings/{listingId}/resourceVersions/{resourceVersion}/agreements")
1138	if err != nil {
1139		return nil, err
1140	}
1141
1142	var response GetAppCatalogListingAgreementsResponse
1143	var httpResponse *http.Response
1144	httpResponse, err = client.Call(ctx, &httpRequest)
1145	defer common.CloseBodyIfValid(httpResponse)
1146	response.RawResponse = httpResponse
1147	if err != nil {
1148		return response, err
1149	}
1150
1151	err = common.UnmarshalResponse(httpResponse, &response)
1152	return response, err
1153}
1154
1155// GetAppCatalogListingResourceVersion Gets the specified listing resource version.
1156func (client ComputeClient) GetAppCatalogListingResourceVersion(ctx context.Context, request GetAppCatalogListingResourceVersionRequest) (response GetAppCatalogListingResourceVersionResponse, err error) {
1157	var ociResponse common.OCIResponse
1158	policy := common.NoRetryPolicy()
1159	if request.RetryPolicy() != nil {
1160		policy = *request.RetryPolicy()
1161	}
1162	ociResponse, err = common.Retry(ctx, request, client.getAppCatalogListingResourceVersion, policy)
1163	if err != nil {
1164		if ociResponse != nil {
1165			response = GetAppCatalogListingResourceVersionResponse{RawResponse: ociResponse.HTTPResponse()}
1166		}
1167		return
1168	}
1169	if convertedResponse, ok := ociResponse.(GetAppCatalogListingResourceVersionResponse); ok {
1170		response = convertedResponse
1171	} else {
1172		err = fmt.Errorf("failed to convert OCIResponse into GetAppCatalogListingResourceVersionResponse")
1173	}
1174	return
1175}
1176
1177// getAppCatalogListingResourceVersion implements the OCIOperation interface (enables retrying operations)
1178func (client ComputeClient) getAppCatalogListingResourceVersion(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1179	httpRequest, err := request.HTTPRequest(http.MethodGet, "/appCatalogListings/{listingId}/resourceVersions/{resourceVersion}")
1180	if err != nil {
1181		return nil, err
1182	}
1183
1184	var response GetAppCatalogListingResourceVersionResponse
1185	var httpResponse *http.Response
1186	httpResponse, err = client.Call(ctx, &httpRequest)
1187	defer common.CloseBodyIfValid(httpResponse)
1188	response.RawResponse = httpResponse
1189	if err != nil {
1190		return response, err
1191	}
1192
1193	err = common.UnmarshalResponse(httpResponse, &response)
1194	return response, err
1195}
1196
1197// GetBootVolumeAttachment Gets information about the specified boot volume attachment.
1198func (client ComputeClient) GetBootVolumeAttachment(ctx context.Context, request GetBootVolumeAttachmentRequest) (response GetBootVolumeAttachmentResponse, err error) {
1199	var ociResponse common.OCIResponse
1200	policy := common.NoRetryPolicy()
1201	if request.RetryPolicy() != nil {
1202		policy = *request.RetryPolicy()
1203	}
1204	ociResponse, err = common.Retry(ctx, request, client.getBootVolumeAttachment, policy)
1205	if err != nil {
1206		if ociResponse != nil {
1207			response = GetBootVolumeAttachmentResponse{RawResponse: ociResponse.HTTPResponse()}
1208		}
1209		return
1210	}
1211	if convertedResponse, ok := ociResponse.(GetBootVolumeAttachmentResponse); ok {
1212		response = convertedResponse
1213	} else {
1214		err = fmt.Errorf("failed to convert OCIResponse into GetBootVolumeAttachmentResponse")
1215	}
1216	return
1217}
1218
1219// getBootVolumeAttachment implements the OCIOperation interface (enables retrying operations)
1220func (client ComputeClient) getBootVolumeAttachment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1221	httpRequest, err := request.HTTPRequest(http.MethodGet, "/bootVolumeAttachments/{bootVolumeAttachmentId}")
1222	if err != nil {
1223		return nil, err
1224	}
1225
1226	var response GetBootVolumeAttachmentResponse
1227	var httpResponse *http.Response
1228	httpResponse, err = client.Call(ctx, &httpRequest)
1229	defer common.CloseBodyIfValid(httpResponse)
1230	response.RawResponse = httpResponse
1231	if err != nil {
1232		return response, err
1233	}
1234
1235	err = common.UnmarshalResponse(httpResponse, &response)
1236	return response, err
1237}
1238
1239// GetConsoleHistory Shows the metadata for the specified console history.
1240// See CaptureConsoleHistory
1241// for details about using the console history operations.
1242func (client ComputeClient) GetConsoleHistory(ctx context.Context, request GetConsoleHistoryRequest) (response GetConsoleHistoryResponse, err error) {
1243	var ociResponse common.OCIResponse
1244	policy := common.NoRetryPolicy()
1245	if request.RetryPolicy() != nil {
1246		policy = *request.RetryPolicy()
1247	}
1248	ociResponse, err = common.Retry(ctx, request, client.getConsoleHistory, policy)
1249	if err != nil {
1250		if ociResponse != nil {
1251			response = GetConsoleHistoryResponse{RawResponse: ociResponse.HTTPResponse()}
1252		}
1253		return
1254	}
1255	if convertedResponse, ok := ociResponse.(GetConsoleHistoryResponse); ok {
1256		response = convertedResponse
1257	} else {
1258		err = fmt.Errorf("failed to convert OCIResponse into GetConsoleHistoryResponse")
1259	}
1260	return
1261}
1262
1263// getConsoleHistory implements the OCIOperation interface (enables retrying operations)
1264func (client ComputeClient) getConsoleHistory(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1265	httpRequest, err := request.HTTPRequest(http.MethodGet, "/instanceConsoleHistories/{instanceConsoleHistoryId}")
1266	if err != nil {
1267		return nil, err
1268	}
1269
1270	var response GetConsoleHistoryResponse
1271	var httpResponse *http.Response
1272	httpResponse, err = client.Call(ctx, &httpRequest)
1273	defer common.CloseBodyIfValid(httpResponse)
1274	response.RawResponse = httpResponse
1275	if err != nil {
1276		return response, err
1277	}
1278
1279	err = common.UnmarshalResponse(httpResponse, &response)
1280	return response, err
1281}
1282
1283// GetConsoleHistoryContent Gets the actual console history data (not the metadata).
1284// See CaptureConsoleHistory
1285// for details about using the console history operations.
1286func (client ComputeClient) GetConsoleHistoryContent(ctx context.Context, request GetConsoleHistoryContentRequest) (response GetConsoleHistoryContentResponse, err error) {
1287	var ociResponse common.OCIResponse
1288	policy := common.NoRetryPolicy()
1289	if request.RetryPolicy() != nil {
1290		policy = *request.RetryPolicy()
1291	}
1292	ociResponse, err = common.Retry(ctx, request, client.getConsoleHistoryContent, policy)
1293	if err != nil {
1294		if ociResponse != nil {
1295			response = GetConsoleHistoryContentResponse{RawResponse: ociResponse.HTTPResponse()}
1296		}
1297		return
1298	}
1299	if convertedResponse, ok := ociResponse.(GetConsoleHistoryContentResponse); ok {
1300		response = convertedResponse
1301	} else {
1302		err = fmt.Errorf("failed to convert OCIResponse into GetConsoleHistoryContentResponse")
1303	}
1304	return
1305}
1306
1307// getConsoleHistoryContent implements the OCIOperation interface (enables retrying operations)
1308func (client ComputeClient) getConsoleHistoryContent(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1309	httpRequest, err := request.HTTPRequest(http.MethodGet, "/instanceConsoleHistories/{instanceConsoleHistoryId}/data")
1310	if err != nil {
1311		return nil, err
1312	}
1313
1314	var response GetConsoleHistoryContentResponse
1315	var httpResponse *http.Response
1316	httpResponse, err = client.Call(ctx, &httpRequest)
1317	defer common.CloseBodyIfValid(httpResponse)
1318	response.RawResponse = httpResponse
1319	if err != nil {
1320		return response, err
1321	}
1322
1323	err = common.UnmarshalResponse(httpResponse, &response)
1324	return response, err
1325}
1326
1327// GetDedicatedVmHost Gets information about the specified dedicated virtual machine host.
1328func (client ComputeClient) GetDedicatedVmHost(ctx context.Context, request GetDedicatedVmHostRequest) (response GetDedicatedVmHostResponse, err error) {
1329	var ociResponse common.OCIResponse
1330	policy := common.NoRetryPolicy()
1331	if request.RetryPolicy() != nil {
1332		policy = *request.RetryPolicy()
1333	}
1334	ociResponse, err = common.Retry(ctx, request, client.getDedicatedVmHost, policy)
1335	if err != nil {
1336		if ociResponse != nil {
1337			response = GetDedicatedVmHostResponse{RawResponse: ociResponse.HTTPResponse()}
1338		}
1339		return
1340	}
1341	if convertedResponse, ok := ociResponse.(GetDedicatedVmHostResponse); ok {
1342		response = convertedResponse
1343	} else {
1344		err = fmt.Errorf("failed to convert OCIResponse into GetDedicatedVmHostResponse")
1345	}
1346	return
1347}
1348
1349// getDedicatedVmHost implements the OCIOperation interface (enables retrying operations)
1350func (client ComputeClient) getDedicatedVmHost(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1351	httpRequest, err := request.HTTPRequest(http.MethodGet, "/dedicatedVmHosts/{dedicatedVmHostId}")
1352	if err != nil {
1353		return nil, err
1354	}
1355
1356	var response GetDedicatedVmHostResponse
1357	var httpResponse *http.Response
1358	httpResponse, err = client.Call(ctx, &httpRequest)
1359	defer common.CloseBodyIfValid(httpResponse)
1360	response.RawResponse = httpResponse
1361	if err != nil {
1362		return response, err
1363	}
1364
1365	err = common.UnmarshalResponse(httpResponse, &response)
1366	return response, err
1367}
1368
1369// GetImage Gets the specified image.
1370func (client ComputeClient) GetImage(ctx context.Context, request GetImageRequest) (response GetImageResponse, err error) {
1371	var ociResponse common.OCIResponse
1372	policy := common.NoRetryPolicy()
1373	if request.RetryPolicy() != nil {
1374		policy = *request.RetryPolicy()
1375	}
1376	ociResponse, err = common.Retry(ctx, request, client.getImage, policy)
1377	if err != nil {
1378		if ociResponse != nil {
1379			response = GetImageResponse{RawResponse: ociResponse.HTTPResponse()}
1380		}
1381		return
1382	}
1383	if convertedResponse, ok := ociResponse.(GetImageResponse); ok {
1384		response = convertedResponse
1385	} else {
1386		err = fmt.Errorf("failed to convert OCIResponse into GetImageResponse")
1387	}
1388	return
1389}
1390
1391// getImage implements the OCIOperation interface (enables retrying operations)
1392func (client ComputeClient) getImage(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1393	httpRequest, err := request.HTTPRequest(http.MethodGet, "/images/{imageId}")
1394	if err != nil {
1395		return nil, err
1396	}
1397
1398	var response GetImageResponse
1399	var httpResponse *http.Response
1400	httpResponse, err = client.Call(ctx, &httpRequest)
1401	defer common.CloseBodyIfValid(httpResponse)
1402	response.RawResponse = httpResponse
1403	if err != nil {
1404		return response, err
1405	}
1406
1407	err = common.UnmarshalResponse(httpResponse, &response)
1408	return response, err
1409}
1410
1411// GetInstance Gets information about the specified instance.
1412func (client ComputeClient) GetInstance(ctx context.Context, request GetInstanceRequest) (response GetInstanceResponse, err error) {
1413	var ociResponse common.OCIResponse
1414	policy := common.NoRetryPolicy()
1415	if request.RetryPolicy() != nil {
1416		policy = *request.RetryPolicy()
1417	}
1418	ociResponse, err = common.Retry(ctx, request, client.getInstance, policy)
1419	if err != nil {
1420		if ociResponse != nil {
1421			response = GetInstanceResponse{RawResponse: ociResponse.HTTPResponse()}
1422		}
1423		return
1424	}
1425	if convertedResponse, ok := ociResponse.(GetInstanceResponse); ok {
1426		response = convertedResponse
1427	} else {
1428		err = fmt.Errorf("failed to convert OCIResponse into GetInstanceResponse")
1429	}
1430	return
1431}
1432
1433// getInstance implements the OCIOperation interface (enables retrying operations)
1434func (client ComputeClient) getInstance(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1435	httpRequest, err := request.HTTPRequest(http.MethodGet, "/instances/{instanceId}")
1436	if err != nil {
1437		return nil, err
1438	}
1439
1440	var response GetInstanceResponse
1441	var httpResponse *http.Response
1442	httpResponse, err = client.Call(ctx, &httpRequest)
1443	defer common.CloseBodyIfValid(httpResponse)
1444	response.RawResponse = httpResponse
1445	if err != nil {
1446		return response, err
1447	}
1448
1449	err = common.UnmarshalResponse(httpResponse, &response)
1450	return response, err
1451}
1452
1453// GetInstanceConsoleConnection Gets the specified instance console connection's information.
1454func (client ComputeClient) GetInstanceConsoleConnection(ctx context.Context, request GetInstanceConsoleConnectionRequest) (response GetInstanceConsoleConnectionResponse, err error) {
1455	var ociResponse common.OCIResponse
1456	policy := common.NoRetryPolicy()
1457	if request.RetryPolicy() != nil {
1458		policy = *request.RetryPolicy()
1459	}
1460	ociResponse, err = common.Retry(ctx, request, client.getInstanceConsoleConnection, policy)
1461	if err != nil {
1462		if ociResponse != nil {
1463			response = GetInstanceConsoleConnectionResponse{RawResponse: ociResponse.HTTPResponse()}
1464		}
1465		return
1466	}
1467	if convertedResponse, ok := ociResponse.(GetInstanceConsoleConnectionResponse); ok {
1468		response = convertedResponse
1469	} else {
1470		err = fmt.Errorf("failed to convert OCIResponse into GetInstanceConsoleConnectionResponse")
1471	}
1472	return
1473}
1474
1475// getInstanceConsoleConnection implements the OCIOperation interface (enables retrying operations)
1476func (client ComputeClient) getInstanceConsoleConnection(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1477	httpRequest, err := request.HTTPRequest(http.MethodGet, "/instanceConsoleConnections/{instanceConsoleConnectionId}")
1478	if err != nil {
1479		return nil, err
1480	}
1481
1482	var response GetInstanceConsoleConnectionResponse
1483	var httpResponse *http.Response
1484	httpResponse, err = client.Call(ctx, &httpRequest)
1485	defer common.CloseBodyIfValid(httpResponse)
1486	response.RawResponse = httpResponse
1487	if err != nil {
1488		return response, err
1489	}
1490
1491	err = common.UnmarshalResponse(httpResponse, &response)
1492	return response, err
1493}
1494
1495// GetVnicAttachment Gets the information for the specified VNIC attachment.
1496func (client ComputeClient) GetVnicAttachment(ctx context.Context, request GetVnicAttachmentRequest) (response GetVnicAttachmentResponse, err error) {
1497	var ociResponse common.OCIResponse
1498	policy := common.NoRetryPolicy()
1499	if request.RetryPolicy() != nil {
1500		policy = *request.RetryPolicy()
1501	}
1502	ociResponse, err = common.Retry(ctx, request, client.getVnicAttachment, policy)
1503	if err != nil {
1504		if ociResponse != nil {
1505			response = GetVnicAttachmentResponse{RawResponse: ociResponse.HTTPResponse()}
1506		}
1507		return
1508	}
1509	if convertedResponse, ok := ociResponse.(GetVnicAttachmentResponse); ok {
1510		response = convertedResponse
1511	} else {
1512		err = fmt.Errorf("failed to convert OCIResponse into GetVnicAttachmentResponse")
1513	}
1514	return
1515}
1516
1517// getVnicAttachment implements the OCIOperation interface (enables retrying operations)
1518func (client ComputeClient) getVnicAttachment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1519	httpRequest, err := request.HTTPRequest(http.MethodGet, "/vnicAttachments/{vnicAttachmentId}")
1520	if err != nil {
1521		return nil, err
1522	}
1523
1524	var response GetVnicAttachmentResponse
1525	var httpResponse *http.Response
1526	httpResponse, err = client.Call(ctx, &httpRequest)
1527	defer common.CloseBodyIfValid(httpResponse)
1528	response.RawResponse = httpResponse
1529	if err != nil {
1530		return response, err
1531	}
1532
1533	err = common.UnmarshalResponse(httpResponse, &response)
1534	return response, err
1535}
1536
1537// GetVolumeAttachment Gets information about the specified volume attachment.
1538func (client ComputeClient) GetVolumeAttachment(ctx context.Context, request GetVolumeAttachmentRequest) (response GetVolumeAttachmentResponse, err error) {
1539	var ociResponse common.OCIResponse
1540	policy := common.NoRetryPolicy()
1541	if request.RetryPolicy() != nil {
1542		policy = *request.RetryPolicy()
1543	}
1544	ociResponse, err = common.Retry(ctx, request, client.getVolumeAttachment, policy)
1545	if err != nil {
1546		if ociResponse != nil {
1547			response = GetVolumeAttachmentResponse{RawResponse: ociResponse.HTTPResponse()}
1548		}
1549		return
1550	}
1551	if convertedResponse, ok := ociResponse.(GetVolumeAttachmentResponse); ok {
1552		response = convertedResponse
1553	} else {
1554		err = fmt.Errorf("failed to convert OCIResponse into GetVolumeAttachmentResponse")
1555	}
1556	return
1557}
1558
1559// getVolumeAttachment implements the OCIOperation interface (enables retrying operations)
1560func (client ComputeClient) getVolumeAttachment(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1561	httpRequest, err := request.HTTPRequest(http.MethodGet, "/volumeAttachments/{volumeAttachmentId}")
1562	if err != nil {
1563		return nil, err
1564	}
1565
1566	var response GetVolumeAttachmentResponse
1567	var httpResponse *http.Response
1568	httpResponse, err = client.Call(ctx, &httpRequest)
1569	defer common.CloseBodyIfValid(httpResponse)
1570	response.RawResponse = httpResponse
1571	if err != nil {
1572		return response, err
1573	}
1574
1575	err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &volumeattachment{})
1576	return response, err
1577}
1578
1579// GetWindowsInstanceInitialCredentials Gets the generated credentials for the instance. Only works for instances that require password to log in (E.g. Windows).
1580// For certain OS'es, users will be forced to change the initial credentials.
1581func (client ComputeClient) GetWindowsInstanceInitialCredentials(ctx context.Context, request GetWindowsInstanceInitialCredentialsRequest) (response GetWindowsInstanceInitialCredentialsResponse, err error) {
1582	var ociResponse common.OCIResponse
1583	policy := common.NoRetryPolicy()
1584	if request.RetryPolicy() != nil {
1585		policy = *request.RetryPolicy()
1586	}
1587	ociResponse, err = common.Retry(ctx, request, client.getWindowsInstanceInitialCredentials, policy)
1588	if err != nil {
1589		if ociResponse != nil {
1590			response = GetWindowsInstanceInitialCredentialsResponse{RawResponse: ociResponse.HTTPResponse()}
1591		}
1592		return
1593	}
1594	if convertedResponse, ok := ociResponse.(GetWindowsInstanceInitialCredentialsResponse); ok {
1595		response = convertedResponse
1596	} else {
1597		err = fmt.Errorf("failed to convert OCIResponse into GetWindowsInstanceInitialCredentialsResponse")
1598	}
1599	return
1600}
1601
1602// getWindowsInstanceInitialCredentials implements the OCIOperation interface (enables retrying operations)
1603func (client ComputeClient) getWindowsInstanceInitialCredentials(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1604	httpRequest, err := request.HTTPRequest(http.MethodGet, "/instances/{instanceId}/initialCredentials")
1605	if err != nil {
1606		return nil, err
1607	}
1608
1609	var response GetWindowsInstanceInitialCredentialsResponse
1610	var httpResponse *http.Response
1611	httpResponse, err = client.Call(ctx, &httpRequest)
1612	defer common.CloseBodyIfValid(httpResponse)
1613	response.RawResponse = httpResponse
1614	if err != nil {
1615		return response, err
1616	}
1617
1618	err = common.UnmarshalResponse(httpResponse, &response)
1619	return response, err
1620}
1621
1622// InstanceAction Performs one of the following power actions on the specified instance:
1623// - **START** - Powers on the instance.
1624// - **STOP** - Powers off the instance.
1625// - **SOFTRESET** - Gracefully reboots instance by sending a shutdown command to the operating system and then powers the instance back on.
1626// - **SOFTSTOP** - Gracefully shuts down instance by sending a shutdown command to the operating system.
1627// - **RESET** - Powers off the instance and then powers it back on.
1628// For more information see Stopping and Starting an Instance (https://docs.cloud.oracle.com/Content/Compute/Tasks/restartinginstance.htm).
1629func (client ComputeClient) InstanceAction(ctx context.Context, request InstanceActionRequest) (response InstanceActionResponse, err error) {
1630	var ociResponse common.OCIResponse
1631	policy := common.NoRetryPolicy()
1632	if request.RetryPolicy() != nil {
1633		policy = *request.RetryPolicy()
1634	}
1635
1636	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
1637		request.OpcRetryToken = common.String(common.RetryToken())
1638	}
1639
1640	ociResponse, err = common.Retry(ctx, request, client.instanceAction, policy)
1641	if err != nil {
1642		if ociResponse != nil {
1643			response = InstanceActionResponse{RawResponse: ociResponse.HTTPResponse()}
1644		}
1645		return
1646	}
1647	if convertedResponse, ok := ociResponse.(InstanceActionResponse); ok {
1648		response = convertedResponse
1649	} else {
1650		err = fmt.Errorf("failed to convert OCIResponse into InstanceActionResponse")
1651	}
1652	return
1653}
1654
1655// instanceAction implements the OCIOperation interface (enables retrying operations)
1656func (client ComputeClient) instanceAction(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1657	httpRequest, err := request.HTTPRequest(http.MethodPost, "/instances/{instanceId}")
1658	if err != nil {
1659		return nil, err
1660	}
1661
1662	var response InstanceActionResponse
1663	var httpResponse *http.Response
1664	httpResponse, err = client.Call(ctx, &httpRequest)
1665	defer common.CloseBodyIfValid(httpResponse)
1666	response.RawResponse = httpResponse
1667	if err != nil {
1668		return response, err
1669	}
1670
1671	err = common.UnmarshalResponse(httpResponse, &response)
1672	return response, err
1673}
1674
1675// LaunchInstance Creates a new instance in the specified compartment and the specified availability domain.
1676// For general information about instances, see
1677// Overview of the Compute Service (https://docs.cloud.oracle.com/Content/Compute/Concepts/computeoverview.htm).
1678// For information about access control and compartments, see
1679// Overview of the IAM Service (https://docs.cloud.oracle.com/Content/Identity/Concepts/overview.htm).
1680// For information about availability domains, see
1681// Regions and Availability Domains (https://docs.cloud.oracle.com/Content/General/Concepts/regions.htm).
1682// To get a list of availability domains, use the `ListAvailabilityDomains` operation
1683// in the Identity and Access Management Service API.
1684// All Oracle Cloud Infrastructure resources, including instances, get an Oracle-assigned,
1685// unique ID called an Oracle Cloud Identifier (OCID).
1686// When you create a resource, you can find its OCID in the response. You can
1687// also retrieve a resource's OCID by using a List API operation
1688// on that resource type, or by viewing the resource in the Console.
1689// To launch an instance using an image or a boot volume use the `sourceDetails` parameter in LaunchInstanceDetails.
1690// When you launch an instance, it is automatically attached to a virtual
1691// network interface card (VNIC), called the *primary VNIC*. The VNIC
1692// has a private IP address from the subnet's CIDR. You can either assign a
1693// private IP address of your choice or let Oracle automatically assign one.
1694// You can choose whether the instance has a public IP address. To retrieve the
1695// addresses, use the ListVnicAttachments
1696// operation to get the VNIC ID for the instance, and then call
1697// GetVnic with the VNIC ID.
1698// You can later add secondary VNICs to an instance. For more information, see
1699// Virtual Network Interface Cards (VNICs) (https://docs.cloud.oracle.com/Content/Network/Tasks/managingVNICs.htm).
1700func (client ComputeClient) LaunchInstance(ctx context.Context, request LaunchInstanceRequest) (response LaunchInstanceResponse, err error) {
1701	var ociResponse common.OCIResponse
1702	policy := common.NoRetryPolicy()
1703	if request.RetryPolicy() != nil {
1704		policy = *request.RetryPolicy()
1705	}
1706
1707	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
1708		request.OpcRetryToken = common.String(common.RetryToken())
1709	}
1710
1711	ociResponse, err = common.Retry(ctx, request, client.launchInstance, policy)
1712	if err != nil {
1713		if ociResponse != nil {
1714			response = LaunchInstanceResponse{RawResponse: ociResponse.HTTPResponse()}
1715		}
1716		return
1717	}
1718	if convertedResponse, ok := ociResponse.(LaunchInstanceResponse); ok {
1719		response = convertedResponse
1720	} else {
1721		err = fmt.Errorf("failed to convert OCIResponse into LaunchInstanceResponse")
1722	}
1723	return
1724}
1725
1726// launchInstance implements the OCIOperation interface (enables retrying operations)
1727func (client ComputeClient) launchInstance(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1728	httpRequest, err := request.HTTPRequest(http.MethodPost, "/instances")
1729	if err != nil {
1730		return nil, err
1731	}
1732
1733	var response LaunchInstanceResponse
1734	var httpResponse *http.Response
1735	httpResponse, err = client.Call(ctx, &httpRequest)
1736	defer common.CloseBodyIfValid(httpResponse)
1737	response.RawResponse = httpResponse
1738	if err != nil {
1739		return response, err
1740	}
1741
1742	err = common.UnmarshalResponse(httpResponse, &response)
1743	return response, err
1744}
1745
1746// ListAppCatalogListingResourceVersions Gets all resource versions for a particular listing.
1747func (client ComputeClient) ListAppCatalogListingResourceVersions(ctx context.Context, request ListAppCatalogListingResourceVersionsRequest) (response ListAppCatalogListingResourceVersionsResponse, err error) {
1748	var ociResponse common.OCIResponse
1749	policy := common.NoRetryPolicy()
1750	if request.RetryPolicy() != nil {
1751		policy = *request.RetryPolicy()
1752	}
1753	ociResponse, err = common.Retry(ctx, request, client.listAppCatalogListingResourceVersions, policy)
1754	if err != nil {
1755		if ociResponse != nil {
1756			response = ListAppCatalogListingResourceVersionsResponse{RawResponse: ociResponse.HTTPResponse()}
1757		}
1758		return
1759	}
1760	if convertedResponse, ok := ociResponse.(ListAppCatalogListingResourceVersionsResponse); ok {
1761		response = convertedResponse
1762	} else {
1763		err = fmt.Errorf("failed to convert OCIResponse into ListAppCatalogListingResourceVersionsResponse")
1764	}
1765	return
1766}
1767
1768// listAppCatalogListingResourceVersions implements the OCIOperation interface (enables retrying operations)
1769func (client ComputeClient) listAppCatalogListingResourceVersions(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1770	httpRequest, err := request.HTTPRequest(http.MethodGet, "/appCatalogListings/{listingId}/resourceVersions")
1771	if err != nil {
1772		return nil, err
1773	}
1774
1775	var response ListAppCatalogListingResourceVersionsResponse
1776	var httpResponse *http.Response
1777	httpResponse, err = client.Call(ctx, &httpRequest)
1778	defer common.CloseBodyIfValid(httpResponse)
1779	response.RawResponse = httpResponse
1780	if err != nil {
1781		return response, err
1782	}
1783
1784	err = common.UnmarshalResponse(httpResponse, &response)
1785	return response, err
1786}
1787
1788// ListAppCatalogListings Lists the published listings.
1789func (client ComputeClient) ListAppCatalogListings(ctx context.Context, request ListAppCatalogListingsRequest) (response ListAppCatalogListingsResponse, err error) {
1790	var ociResponse common.OCIResponse
1791	policy := common.NoRetryPolicy()
1792	if request.RetryPolicy() != nil {
1793		policy = *request.RetryPolicy()
1794	}
1795	ociResponse, err = common.Retry(ctx, request, client.listAppCatalogListings, policy)
1796	if err != nil {
1797		if ociResponse != nil {
1798			response = ListAppCatalogListingsResponse{RawResponse: ociResponse.HTTPResponse()}
1799		}
1800		return
1801	}
1802	if convertedResponse, ok := ociResponse.(ListAppCatalogListingsResponse); ok {
1803		response = convertedResponse
1804	} else {
1805		err = fmt.Errorf("failed to convert OCIResponse into ListAppCatalogListingsResponse")
1806	}
1807	return
1808}
1809
1810// listAppCatalogListings implements the OCIOperation interface (enables retrying operations)
1811func (client ComputeClient) listAppCatalogListings(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1812	httpRequest, err := request.HTTPRequest(http.MethodGet, "/appCatalogListings")
1813	if err != nil {
1814		return nil, err
1815	}
1816
1817	var response ListAppCatalogListingsResponse
1818	var httpResponse *http.Response
1819	httpResponse, err = client.Call(ctx, &httpRequest)
1820	defer common.CloseBodyIfValid(httpResponse)
1821	response.RawResponse = httpResponse
1822	if err != nil {
1823		return response, err
1824	}
1825
1826	err = common.UnmarshalResponse(httpResponse, &response)
1827	return response, err
1828}
1829
1830// ListAppCatalogSubscriptions Lists subscriptions for a compartment.
1831func (client ComputeClient) ListAppCatalogSubscriptions(ctx context.Context, request ListAppCatalogSubscriptionsRequest) (response ListAppCatalogSubscriptionsResponse, err error) {
1832	var ociResponse common.OCIResponse
1833	policy := common.NoRetryPolicy()
1834	if request.RetryPolicy() != nil {
1835		policy = *request.RetryPolicy()
1836	}
1837	ociResponse, err = common.Retry(ctx, request, client.listAppCatalogSubscriptions, policy)
1838	if err != nil {
1839		if ociResponse != nil {
1840			response = ListAppCatalogSubscriptionsResponse{RawResponse: ociResponse.HTTPResponse()}
1841		}
1842		return
1843	}
1844	if convertedResponse, ok := ociResponse.(ListAppCatalogSubscriptionsResponse); ok {
1845		response = convertedResponse
1846	} else {
1847		err = fmt.Errorf("failed to convert OCIResponse into ListAppCatalogSubscriptionsResponse")
1848	}
1849	return
1850}
1851
1852// listAppCatalogSubscriptions implements the OCIOperation interface (enables retrying operations)
1853func (client ComputeClient) listAppCatalogSubscriptions(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1854	httpRequest, err := request.HTTPRequest(http.MethodGet, "/appCatalogSubscriptions")
1855	if err != nil {
1856		return nil, err
1857	}
1858
1859	var response ListAppCatalogSubscriptionsResponse
1860	var httpResponse *http.Response
1861	httpResponse, err = client.Call(ctx, &httpRequest)
1862	defer common.CloseBodyIfValid(httpResponse)
1863	response.RawResponse = httpResponse
1864	if err != nil {
1865		return response, err
1866	}
1867
1868	err = common.UnmarshalResponse(httpResponse, &response)
1869	return response, err
1870}
1871
1872// ListBootVolumeAttachments Lists the boot volume attachments in the specified compartment. You can filter the
1873// list by specifying an instance OCID, boot volume OCID, or both.
1874func (client ComputeClient) ListBootVolumeAttachments(ctx context.Context, request ListBootVolumeAttachmentsRequest) (response ListBootVolumeAttachmentsResponse, err error) {
1875	var ociResponse common.OCIResponse
1876	policy := common.NoRetryPolicy()
1877	if request.RetryPolicy() != nil {
1878		policy = *request.RetryPolicy()
1879	}
1880	ociResponse, err = common.Retry(ctx, request, client.listBootVolumeAttachments, policy)
1881	if err != nil {
1882		if ociResponse != nil {
1883			response = ListBootVolumeAttachmentsResponse{RawResponse: ociResponse.HTTPResponse()}
1884		}
1885		return
1886	}
1887	if convertedResponse, ok := ociResponse.(ListBootVolumeAttachmentsResponse); ok {
1888		response = convertedResponse
1889	} else {
1890		err = fmt.Errorf("failed to convert OCIResponse into ListBootVolumeAttachmentsResponse")
1891	}
1892	return
1893}
1894
1895// listBootVolumeAttachments implements the OCIOperation interface (enables retrying operations)
1896func (client ComputeClient) listBootVolumeAttachments(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1897	httpRequest, err := request.HTTPRequest(http.MethodGet, "/bootVolumeAttachments")
1898	if err != nil {
1899		return nil, err
1900	}
1901
1902	var response ListBootVolumeAttachmentsResponse
1903	var httpResponse *http.Response
1904	httpResponse, err = client.Call(ctx, &httpRequest)
1905	defer common.CloseBodyIfValid(httpResponse)
1906	response.RawResponse = httpResponse
1907	if err != nil {
1908		return response, err
1909	}
1910
1911	err = common.UnmarshalResponse(httpResponse, &response)
1912	return response, err
1913}
1914
1915// ListConsoleHistories Lists the console history metadata for the specified compartment or instance.
1916func (client ComputeClient) ListConsoleHistories(ctx context.Context, request ListConsoleHistoriesRequest) (response ListConsoleHistoriesResponse, err error) {
1917	var ociResponse common.OCIResponse
1918	policy := common.NoRetryPolicy()
1919	if request.RetryPolicy() != nil {
1920		policy = *request.RetryPolicy()
1921	}
1922	ociResponse, err = common.Retry(ctx, request, client.listConsoleHistories, policy)
1923	if err != nil {
1924		if ociResponse != nil {
1925			response = ListConsoleHistoriesResponse{RawResponse: ociResponse.HTTPResponse()}
1926		}
1927		return
1928	}
1929	if convertedResponse, ok := ociResponse.(ListConsoleHistoriesResponse); ok {
1930		response = convertedResponse
1931	} else {
1932		err = fmt.Errorf("failed to convert OCIResponse into ListConsoleHistoriesResponse")
1933	}
1934	return
1935}
1936
1937// listConsoleHistories implements the OCIOperation interface (enables retrying operations)
1938func (client ComputeClient) listConsoleHistories(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1939	httpRequest, err := request.HTTPRequest(http.MethodGet, "/instanceConsoleHistories")
1940	if err != nil {
1941		return nil, err
1942	}
1943
1944	var response ListConsoleHistoriesResponse
1945	var httpResponse *http.Response
1946	httpResponse, err = client.Call(ctx, &httpRequest)
1947	defer common.CloseBodyIfValid(httpResponse)
1948	response.RawResponse = httpResponse
1949	if err != nil {
1950		return response, err
1951	}
1952
1953	err = common.UnmarshalResponse(httpResponse, &response)
1954	return response, err
1955}
1956
1957// ListDedicatedVmHostInstanceShapes Lists the shapes that can be used to launch a virtual machine instance on a dedicated virtual machine host within the specified compartment.
1958// You can filter the list by compatibility with a specific dedicated virtual machine host shape.
1959func (client ComputeClient) ListDedicatedVmHostInstanceShapes(ctx context.Context, request ListDedicatedVmHostInstanceShapesRequest) (response ListDedicatedVmHostInstanceShapesResponse, err error) {
1960	var ociResponse common.OCIResponse
1961	policy := common.NoRetryPolicy()
1962	if request.RetryPolicy() != nil {
1963		policy = *request.RetryPolicy()
1964	}
1965	ociResponse, err = common.Retry(ctx, request, client.listDedicatedVmHostInstanceShapes, policy)
1966	if err != nil {
1967		if ociResponse != nil {
1968			response = ListDedicatedVmHostInstanceShapesResponse{RawResponse: ociResponse.HTTPResponse()}
1969		}
1970		return
1971	}
1972	if convertedResponse, ok := ociResponse.(ListDedicatedVmHostInstanceShapesResponse); ok {
1973		response = convertedResponse
1974	} else {
1975		err = fmt.Errorf("failed to convert OCIResponse into ListDedicatedVmHostInstanceShapesResponse")
1976	}
1977	return
1978}
1979
1980// listDedicatedVmHostInstanceShapes implements the OCIOperation interface (enables retrying operations)
1981func (client ComputeClient) listDedicatedVmHostInstanceShapes(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
1982	httpRequest, err := request.HTTPRequest(http.MethodGet, "/dedicatedVmHostInstanceShapes")
1983	if err != nil {
1984		return nil, err
1985	}
1986
1987	var response ListDedicatedVmHostInstanceShapesResponse
1988	var httpResponse *http.Response
1989	httpResponse, err = client.Call(ctx, &httpRequest)
1990	defer common.CloseBodyIfValid(httpResponse)
1991	response.RawResponse = httpResponse
1992	if err != nil {
1993		return response, err
1994	}
1995
1996	err = common.UnmarshalResponse(httpResponse, &response)
1997	return response, err
1998}
1999
2000// ListDedicatedVmHostInstances Returns the list of instances on the dedicated virtual machine hosts that match the specified criteria.
2001func (client ComputeClient) ListDedicatedVmHostInstances(ctx context.Context, request ListDedicatedVmHostInstancesRequest) (response ListDedicatedVmHostInstancesResponse, err error) {
2002	var ociResponse common.OCIResponse
2003	policy := common.NoRetryPolicy()
2004	if request.RetryPolicy() != nil {
2005		policy = *request.RetryPolicy()
2006	}
2007	ociResponse, err = common.Retry(ctx, request, client.listDedicatedVmHostInstances, policy)
2008	if err != nil {
2009		if ociResponse != nil {
2010			response = ListDedicatedVmHostInstancesResponse{RawResponse: ociResponse.HTTPResponse()}
2011		}
2012		return
2013	}
2014	if convertedResponse, ok := ociResponse.(ListDedicatedVmHostInstancesResponse); ok {
2015		response = convertedResponse
2016	} else {
2017		err = fmt.Errorf("failed to convert OCIResponse into ListDedicatedVmHostInstancesResponse")
2018	}
2019	return
2020}
2021
2022// listDedicatedVmHostInstances implements the OCIOperation interface (enables retrying operations)
2023func (client ComputeClient) listDedicatedVmHostInstances(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2024	httpRequest, err := request.HTTPRequest(http.MethodGet, "/dedicatedVmHosts/{dedicatedVmHostId}/instances")
2025	if err != nil {
2026		return nil, err
2027	}
2028
2029	var response ListDedicatedVmHostInstancesResponse
2030	var httpResponse *http.Response
2031	httpResponse, err = client.Call(ctx, &httpRequest)
2032	defer common.CloseBodyIfValid(httpResponse)
2033	response.RawResponse = httpResponse
2034	if err != nil {
2035		return response, err
2036	}
2037
2038	err = common.UnmarshalResponse(httpResponse, &response)
2039	return response, err
2040}
2041
2042// ListDedicatedVmHostShapes Lists the shapes that can be used to launch a dedicated virtual machine host within the specified compartment.
2043func (client ComputeClient) ListDedicatedVmHostShapes(ctx context.Context, request ListDedicatedVmHostShapesRequest) (response ListDedicatedVmHostShapesResponse, err error) {
2044	var ociResponse common.OCIResponse
2045	policy := common.NoRetryPolicy()
2046	if request.RetryPolicy() != nil {
2047		policy = *request.RetryPolicy()
2048	}
2049	ociResponse, err = common.Retry(ctx, request, client.listDedicatedVmHostShapes, policy)
2050	if err != nil {
2051		if ociResponse != nil {
2052			response = ListDedicatedVmHostShapesResponse{RawResponse: ociResponse.HTTPResponse()}
2053		}
2054		return
2055	}
2056	if convertedResponse, ok := ociResponse.(ListDedicatedVmHostShapesResponse); ok {
2057		response = convertedResponse
2058	} else {
2059		err = fmt.Errorf("failed to convert OCIResponse into ListDedicatedVmHostShapesResponse")
2060	}
2061	return
2062}
2063
2064// listDedicatedVmHostShapes implements the OCIOperation interface (enables retrying operations)
2065func (client ComputeClient) listDedicatedVmHostShapes(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2066	httpRequest, err := request.HTTPRequest(http.MethodGet, "/dedicatedVmHostShapes")
2067	if err != nil {
2068		return nil, err
2069	}
2070
2071	var response ListDedicatedVmHostShapesResponse
2072	var httpResponse *http.Response
2073	httpResponse, err = client.Call(ctx, &httpRequest)
2074	defer common.CloseBodyIfValid(httpResponse)
2075	response.RawResponse = httpResponse
2076	if err != nil {
2077		return response, err
2078	}
2079
2080	err = common.UnmarshalResponse(httpResponse, &response)
2081	return response, err
2082}
2083
2084// ListDedicatedVmHosts Returns the list of dedicated virtual machine hosts that match the specified criteria in the specified compartment.
2085// You can limit the list by specifying a dedicated virtual machine host display name. The list will include all the identically-named
2086// dedicated virtual machine hosts in the compartment.
2087func (client ComputeClient) ListDedicatedVmHosts(ctx context.Context, request ListDedicatedVmHostsRequest) (response ListDedicatedVmHostsResponse, err error) {
2088	var ociResponse common.OCIResponse
2089	policy := common.NoRetryPolicy()
2090	if request.RetryPolicy() != nil {
2091		policy = *request.RetryPolicy()
2092	}
2093	ociResponse, err = common.Retry(ctx, request, client.listDedicatedVmHosts, policy)
2094	if err != nil {
2095		if ociResponse != nil {
2096			response = ListDedicatedVmHostsResponse{RawResponse: ociResponse.HTTPResponse()}
2097		}
2098		return
2099	}
2100	if convertedResponse, ok := ociResponse.(ListDedicatedVmHostsResponse); ok {
2101		response = convertedResponse
2102	} else {
2103		err = fmt.Errorf("failed to convert OCIResponse into ListDedicatedVmHostsResponse")
2104	}
2105	return
2106}
2107
2108// listDedicatedVmHosts implements the OCIOperation interface (enables retrying operations)
2109func (client ComputeClient) listDedicatedVmHosts(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2110	httpRequest, err := request.HTTPRequest(http.MethodGet, "/dedicatedVmHosts")
2111	if err != nil {
2112		return nil, err
2113	}
2114
2115	var response ListDedicatedVmHostsResponse
2116	var httpResponse *http.Response
2117	httpResponse, err = client.Call(ctx, &httpRequest)
2118	defer common.CloseBodyIfValid(httpResponse)
2119	response.RawResponse = httpResponse
2120	if err != nil {
2121		return response, err
2122	}
2123
2124	err = common.UnmarshalResponse(httpResponse, &response)
2125	return response, err
2126}
2127
2128// ListImages Lists the available images in the specified compartment, including both
2129// Oracle-provided images (https://docs.cloud.oracle.com/Content/Compute/References/images.htm) and
2130// custom images (https://docs.cloud.oracle.com/Content/Compute/Tasks/managingcustomimages.htm) that have
2131// been created. The list of images returned is ordered to first show all
2132// Oracle-provided images, then all custom images.
2133// The order of images returned may change when new images are released.
2134func (client ComputeClient) ListImages(ctx context.Context, request ListImagesRequest) (response ListImagesResponse, err error) {
2135	var ociResponse common.OCIResponse
2136	policy := common.NoRetryPolicy()
2137	if request.RetryPolicy() != nil {
2138		policy = *request.RetryPolicy()
2139	}
2140	ociResponse, err = common.Retry(ctx, request, client.listImages, policy)
2141	if err != nil {
2142		if ociResponse != nil {
2143			response = ListImagesResponse{RawResponse: ociResponse.HTTPResponse()}
2144		}
2145		return
2146	}
2147	if convertedResponse, ok := ociResponse.(ListImagesResponse); ok {
2148		response = convertedResponse
2149	} else {
2150		err = fmt.Errorf("failed to convert OCIResponse into ListImagesResponse")
2151	}
2152	return
2153}
2154
2155// listImages implements the OCIOperation interface (enables retrying operations)
2156func (client ComputeClient) listImages(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2157	httpRequest, err := request.HTTPRequest(http.MethodGet, "/images")
2158	if err != nil {
2159		return nil, err
2160	}
2161
2162	var response ListImagesResponse
2163	var httpResponse *http.Response
2164	httpResponse, err = client.Call(ctx, &httpRequest)
2165	defer common.CloseBodyIfValid(httpResponse)
2166	response.RawResponse = httpResponse
2167	if err != nil {
2168		return response, err
2169	}
2170
2171	err = common.UnmarshalResponse(httpResponse, &response)
2172	return response, err
2173}
2174
2175// ListInstanceConsoleConnections Lists the console connections for the specified compartment or instance.
2176// For more information about console access, see Accessing the Console (https://docs.cloud.oracle.com/Content/Compute/References/serialconsole.htm).
2177func (client ComputeClient) ListInstanceConsoleConnections(ctx context.Context, request ListInstanceConsoleConnectionsRequest) (response ListInstanceConsoleConnectionsResponse, err error) {
2178	var ociResponse common.OCIResponse
2179	policy := common.NoRetryPolicy()
2180	if request.RetryPolicy() != nil {
2181		policy = *request.RetryPolicy()
2182	}
2183	ociResponse, err = common.Retry(ctx, request, client.listInstanceConsoleConnections, policy)
2184	if err != nil {
2185		if ociResponse != nil {
2186			response = ListInstanceConsoleConnectionsResponse{RawResponse: ociResponse.HTTPResponse()}
2187		}
2188		return
2189	}
2190	if convertedResponse, ok := ociResponse.(ListInstanceConsoleConnectionsResponse); ok {
2191		response = convertedResponse
2192	} else {
2193		err = fmt.Errorf("failed to convert OCIResponse into ListInstanceConsoleConnectionsResponse")
2194	}
2195	return
2196}
2197
2198// listInstanceConsoleConnections implements the OCIOperation interface (enables retrying operations)
2199func (client ComputeClient) listInstanceConsoleConnections(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2200	httpRequest, err := request.HTTPRequest(http.MethodGet, "/instanceConsoleConnections")
2201	if err != nil {
2202		return nil, err
2203	}
2204
2205	var response ListInstanceConsoleConnectionsResponse
2206	var httpResponse *http.Response
2207	httpResponse, err = client.Call(ctx, &httpRequest)
2208	defer common.CloseBodyIfValid(httpResponse)
2209	response.RawResponse = httpResponse
2210	if err != nil {
2211		return response, err
2212	}
2213
2214	err = common.UnmarshalResponse(httpResponse, &response)
2215	return response, err
2216}
2217
2218// ListInstanceDevices Gets a list of all the devices for given instance. You can optionally filter results by device availability.
2219func (client ComputeClient) ListInstanceDevices(ctx context.Context, request ListInstanceDevicesRequest) (response ListInstanceDevicesResponse, err error) {
2220	var ociResponse common.OCIResponse
2221	policy := common.NoRetryPolicy()
2222	if request.RetryPolicy() != nil {
2223		policy = *request.RetryPolicy()
2224	}
2225	ociResponse, err = common.Retry(ctx, request, client.listInstanceDevices, policy)
2226	if err != nil {
2227		if ociResponse != nil {
2228			response = ListInstanceDevicesResponse{RawResponse: ociResponse.HTTPResponse()}
2229		}
2230		return
2231	}
2232	if convertedResponse, ok := ociResponse.(ListInstanceDevicesResponse); ok {
2233		response = convertedResponse
2234	} else {
2235		err = fmt.Errorf("failed to convert OCIResponse into ListInstanceDevicesResponse")
2236	}
2237	return
2238}
2239
2240// listInstanceDevices implements the OCIOperation interface (enables retrying operations)
2241func (client ComputeClient) listInstanceDevices(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2242	httpRequest, err := request.HTTPRequest(http.MethodGet, "/instances/{instanceId}/devices")
2243	if err != nil {
2244		return nil, err
2245	}
2246
2247	var response ListInstanceDevicesResponse
2248	var httpResponse *http.Response
2249	httpResponse, err = client.Call(ctx, &httpRequest)
2250	defer common.CloseBodyIfValid(httpResponse)
2251	response.RawResponse = httpResponse
2252	if err != nil {
2253		return response, err
2254	}
2255
2256	err = common.UnmarshalResponse(httpResponse, &response)
2257	return response, err
2258}
2259
2260// ListInstances Lists the instances in the specified compartment and the specified availability domain.
2261// You can filter the results by specifying an instance name (the list will include all the identically-named
2262// instances in the compartment).
2263func (client ComputeClient) ListInstances(ctx context.Context, request ListInstancesRequest) (response ListInstancesResponse, err error) {
2264	var ociResponse common.OCIResponse
2265	policy := common.NoRetryPolicy()
2266	if request.RetryPolicy() != nil {
2267		policy = *request.RetryPolicy()
2268	}
2269	ociResponse, err = common.Retry(ctx, request, client.listInstances, policy)
2270	if err != nil {
2271		if ociResponse != nil {
2272			response = ListInstancesResponse{RawResponse: ociResponse.HTTPResponse()}
2273		}
2274		return
2275	}
2276	if convertedResponse, ok := ociResponse.(ListInstancesResponse); ok {
2277		response = convertedResponse
2278	} else {
2279		err = fmt.Errorf("failed to convert OCIResponse into ListInstancesResponse")
2280	}
2281	return
2282}
2283
2284// listInstances implements the OCIOperation interface (enables retrying operations)
2285func (client ComputeClient) listInstances(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2286	httpRequest, err := request.HTTPRequest(http.MethodGet, "/instances")
2287	if err != nil {
2288		return nil, err
2289	}
2290
2291	var response ListInstancesResponse
2292	var httpResponse *http.Response
2293	httpResponse, err = client.Call(ctx, &httpRequest)
2294	defer common.CloseBodyIfValid(httpResponse)
2295	response.RawResponse = httpResponse
2296	if err != nil {
2297		return response, err
2298	}
2299
2300	err = common.UnmarshalResponse(httpResponse, &response)
2301	return response, err
2302}
2303
2304// ListShapes Lists the shapes that can be used to launch an instance within the specified compartment. You can
2305// filter the list by compatibility with a specific image.
2306func (client ComputeClient) ListShapes(ctx context.Context, request ListShapesRequest) (response ListShapesResponse, err error) {
2307	var ociResponse common.OCIResponse
2308	policy := common.NoRetryPolicy()
2309	if request.RetryPolicy() != nil {
2310		policy = *request.RetryPolicy()
2311	}
2312	ociResponse, err = common.Retry(ctx, request, client.listShapes, policy)
2313	if err != nil {
2314		if ociResponse != nil {
2315			response = ListShapesResponse{RawResponse: ociResponse.HTTPResponse()}
2316		}
2317		return
2318	}
2319	if convertedResponse, ok := ociResponse.(ListShapesResponse); ok {
2320		response = convertedResponse
2321	} else {
2322		err = fmt.Errorf("failed to convert OCIResponse into ListShapesResponse")
2323	}
2324	return
2325}
2326
2327// listShapes implements the OCIOperation interface (enables retrying operations)
2328func (client ComputeClient) listShapes(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2329	httpRequest, err := request.HTTPRequest(http.MethodGet, "/shapes")
2330	if err != nil {
2331		return nil, err
2332	}
2333
2334	var response ListShapesResponse
2335	var httpResponse *http.Response
2336	httpResponse, err = client.Call(ctx, &httpRequest)
2337	defer common.CloseBodyIfValid(httpResponse)
2338	response.RawResponse = httpResponse
2339	if err != nil {
2340		return response, err
2341	}
2342
2343	err = common.UnmarshalResponse(httpResponse, &response)
2344	return response, err
2345}
2346
2347// ListVnicAttachments Lists the VNIC attachments in the specified compartment. A VNIC attachment
2348// resides in the same compartment as the attached instance. The list can be
2349// filtered by instance, VNIC, or availability domain.
2350func (client ComputeClient) ListVnicAttachments(ctx context.Context, request ListVnicAttachmentsRequest) (response ListVnicAttachmentsResponse, err error) {
2351	var ociResponse common.OCIResponse
2352	policy := common.NoRetryPolicy()
2353	if request.RetryPolicy() != nil {
2354		policy = *request.RetryPolicy()
2355	}
2356	ociResponse, err = common.Retry(ctx, request, client.listVnicAttachments, policy)
2357	if err != nil {
2358		if ociResponse != nil {
2359			response = ListVnicAttachmentsResponse{RawResponse: ociResponse.HTTPResponse()}
2360		}
2361		return
2362	}
2363	if convertedResponse, ok := ociResponse.(ListVnicAttachmentsResponse); ok {
2364		response = convertedResponse
2365	} else {
2366		err = fmt.Errorf("failed to convert OCIResponse into ListVnicAttachmentsResponse")
2367	}
2368	return
2369}
2370
2371// listVnicAttachments implements the OCIOperation interface (enables retrying operations)
2372func (client ComputeClient) listVnicAttachments(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2373	httpRequest, err := request.HTTPRequest(http.MethodGet, "/vnicAttachments")
2374	if err != nil {
2375		return nil, err
2376	}
2377
2378	var response ListVnicAttachmentsResponse
2379	var httpResponse *http.Response
2380	httpResponse, err = client.Call(ctx, &httpRequest)
2381	defer common.CloseBodyIfValid(httpResponse)
2382	response.RawResponse = httpResponse
2383	if err != nil {
2384		return response, err
2385	}
2386
2387	err = common.UnmarshalResponse(httpResponse, &response)
2388	return response, err
2389}
2390
2391//listvolumeattachment allows to unmarshal list of polymorphic VolumeAttachment
2392type listvolumeattachment []volumeattachment
2393
2394//UnmarshalPolymorphicJSON unmarshals polymorphic json list of items
2395func (m *listvolumeattachment) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {
2396	res := make([]VolumeAttachment, len(*m))
2397	for i, v := range *m {
2398		nn, err := v.UnmarshalPolymorphicJSON(v.JsonData)
2399		if err != nil {
2400			return nil, err
2401		}
2402		res[i] = nn.(VolumeAttachment)
2403	}
2404	return res, nil
2405}
2406
2407// ListVolumeAttachments Lists the volume attachments in the specified compartment. You can filter the
2408// list by specifying an instance OCID, volume OCID, or both.
2409// Currently, the only supported volume attachment type are IScsiVolumeAttachment and
2410// ParavirtualizedVolumeAttachment.
2411func (client ComputeClient) ListVolumeAttachments(ctx context.Context, request ListVolumeAttachmentsRequest) (response ListVolumeAttachmentsResponse, err error) {
2412	var ociResponse common.OCIResponse
2413	policy := common.NoRetryPolicy()
2414	if request.RetryPolicy() != nil {
2415		policy = *request.RetryPolicy()
2416	}
2417	ociResponse, err = common.Retry(ctx, request, client.listVolumeAttachments, policy)
2418	if err != nil {
2419		if ociResponse != nil {
2420			response = ListVolumeAttachmentsResponse{RawResponse: ociResponse.HTTPResponse()}
2421		}
2422		return
2423	}
2424	if convertedResponse, ok := ociResponse.(ListVolumeAttachmentsResponse); ok {
2425		response = convertedResponse
2426	} else {
2427		err = fmt.Errorf("failed to convert OCIResponse into ListVolumeAttachmentsResponse")
2428	}
2429	return
2430}
2431
2432// listVolumeAttachments implements the OCIOperation interface (enables retrying operations)
2433func (client ComputeClient) listVolumeAttachments(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2434	httpRequest, err := request.HTTPRequest(http.MethodGet, "/volumeAttachments")
2435	if err != nil {
2436		return nil, err
2437	}
2438
2439	var response ListVolumeAttachmentsResponse
2440	var httpResponse *http.Response
2441	httpResponse, err = client.Call(ctx, &httpRequest)
2442	defer common.CloseBodyIfValid(httpResponse)
2443	response.RawResponse = httpResponse
2444	if err != nil {
2445		return response, err
2446	}
2447
2448	err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &listvolumeattachment{})
2449	return response, err
2450}
2451
2452// RemoveImageShapeCompatibilityEntry Removes a shape from the compatible shapes list for the image.
2453func (client ComputeClient) RemoveImageShapeCompatibilityEntry(ctx context.Context, request RemoveImageShapeCompatibilityEntryRequest) (response RemoveImageShapeCompatibilityEntryResponse, err error) {
2454	var ociResponse common.OCIResponse
2455	policy := common.NoRetryPolicy()
2456	if request.RetryPolicy() != nil {
2457		policy = *request.RetryPolicy()
2458	}
2459	ociResponse, err = common.Retry(ctx, request, client.removeImageShapeCompatibilityEntry, policy)
2460	if err != nil {
2461		if ociResponse != nil {
2462			response = RemoveImageShapeCompatibilityEntryResponse{RawResponse: ociResponse.HTTPResponse()}
2463		}
2464		return
2465	}
2466	if convertedResponse, ok := ociResponse.(RemoveImageShapeCompatibilityEntryResponse); ok {
2467		response = convertedResponse
2468	} else {
2469		err = fmt.Errorf("failed to convert OCIResponse into RemoveImageShapeCompatibilityEntryResponse")
2470	}
2471	return
2472}
2473
2474// removeImageShapeCompatibilityEntry implements the OCIOperation interface (enables retrying operations)
2475func (client ComputeClient) removeImageShapeCompatibilityEntry(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2476	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/images/{imageId}/shapes/{shapeName}")
2477	if err != nil {
2478		return nil, err
2479	}
2480
2481	var response RemoveImageShapeCompatibilityEntryResponse
2482	var httpResponse *http.Response
2483	httpResponse, err = client.Call(ctx, &httpRequest)
2484	defer common.CloseBodyIfValid(httpResponse)
2485	response.RawResponse = httpResponse
2486	if err != nil {
2487		return response, err
2488	}
2489
2490	err = common.UnmarshalResponse(httpResponse, &response)
2491	return response, err
2492}
2493
2494// TerminateInstance Terminates the specified instance. Any attached VNICs and volumes are automatically detached
2495// when the instance terminates.
2496// To preserve the boot volume associated with the instance, specify `true` for `PreserveBootVolumeQueryParam`.
2497// To delete the boot volume when the instance is deleted, specify `false` or do not specify a value for `PreserveBootVolumeQueryParam`.
2498// This is an asynchronous operation. The instance's `lifecycleState` will change to TERMINATING temporarily
2499// until the instance is completely removed.
2500func (client ComputeClient) TerminateInstance(ctx context.Context, request TerminateInstanceRequest) (response TerminateInstanceResponse, err error) {
2501	var ociResponse common.OCIResponse
2502	policy := common.NoRetryPolicy()
2503	if request.RetryPolicy() != nil {
2504		policy = *request.RetryPolicy()
2505	}
2506	ociResponse, err = common.Retry(ctx, request, client.terminateInstance, policy)
2507	if err != nil {
2508		if ociResponse != nil {
2509			response = TerminateInstanceResponse{RawResponse: ociResponse.HTTPResponse()}
2510		}
2511		return
2512	}
2513	if convertedResponse, ok := ociResponse.(TerminateInstanceResponse); ok {
2514		response = convertedResponse
2515	} else {
2516		err = fmt.Errorf("failed to convert OCIResponse into TerminateInstanceResponse")
2517	}
2518	return
2519}
2520
2521// terminateInstance implements the OCIOperation interface (enables retrying operations)
2522func (client ComputeClient) terminateInstance(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2523	httpRequest, err := request.HTTPRequest(http.MethodDelete, "/instances/{instanceId}")
2524	if err != nil {
2525		return nil, err
2526	}
2527
2528	var response TerminateInstanceResponse
2529	var httpResponse *http.Response
2530	httpResponse, err = client.Call(ctx, &httpRequest)
2531	defer common.CloseBodyIfValid(httpResponse)
2532	response.RawResponse = httpResponse
2533	if err != nil {
2534		return response, err
2535	}
2536
2537	err = common.UnmarshalResponse(httpResponse, &response)
2538	return response, err
2539}
2540
2541// UpdateConsoleHistory Updates the specified console history metadata.
2542func (client ComputeClient) UpdateConsoleHistory(ctx context.Context, request UpdateConsoleHistoryRequest) (response UpdateConsoleHistoryResponse, err error) {
2543	var ociResponse common.OCIResponse
2544	policy := common.NoRetryPolicy()
2545	if request.RetryPolicy() != nil {
2546		policy = *request.RetryPolicy()
2547	}
2548	ociResponse, err = common.Retry(ctx, request, client.updateConsoleHistory, policy)
2549	if err != nil {
2550		if ociResponse != nil {
2551			response = UpdateConsoleHistoryResponse{RawResponse: ociResponse.HTTPResponse()}
2552		}
2553		return
2554	}
2555	if convertedResponse, ok := ociResponse.(UpdateConsoleHistoryResponse); ok {
2556		response = convertedResponse
2557	} else {
2558		err = fmt.Errorf("failed to convert OCIResponse into UpdateConsoleHistoryResponse")
2559	}
2560	return
2561}
2562
2563// updateConsoleHistory implements the OCIOperation interface (enables retrying operations)
2564func (client ComputeClient) updateConsoleHistory(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2565	httpRequest, err := request.HTTPRequest(http.MethodPut, "/instanceConsoleHistories/{instanceConsoleHistoryId}")
2566	if err != nil {
2567		return nil, err
2568	}
2569
2570	var response UpdateConsoleHistoryResponse
2571	var httpResponse *http.Response
2572	httpResponse, err = client.Call(ctx, &httpRequest)
2573	defer common.CloseBodyIfValid(httpResponse)
2574	response.RawResponse = httpResponse
2575	if err != nil {
2576		return response, err
2577	}
2578
2579	err = common.UnmarshalResponse(httpResponse, &response)
2580	return response, err
2581}
2582
2583// UpdateDedicatedVmHost Updates the displayName, freeformTags, and definedTags attributes for the specified dedicated virtual machine host.
2584// If an attribute value is not included, it will not be updated.
2585func (client ComputeClient) UpdateDedicatedVmHost(ctx context.Context, request UpdateDedicatedVmHostRequest) (response UpdateDedicatedVmHostResponse, err error) {
2586	var ociResponse common.OCIResponse
2587	policy := common.NoRetryPolicy()
2588	if request.RetryPolicy() != nil {
2589		policy = *request.RetryPolicy()
2590	}
2591
2592	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
2593		request.OpcRetryToken = common.String(common.RetryToken())
2594	}
2595
2596	ociResponse, err = common.Retry(ctx, request, client.updateDedicatedVmHost, policy)
2597	if err != nil {
2598		if ociResponse != nil {
2599			response = UpdateDedicatedVmHostResponse{RawResponse: ociResponse.HTTPResponse()}
2600		}
2601		return
2602	}
2603	if convertedResponse, ok := ociResponse.(UpdateDedicatedVmHostResponse); ok {
2604		response = convertedResponse
2605	} else {
2606		err = fmt.Errorf("failed to convert OCIResponse into UpdateDedicatedVmHostResponse")
2607	}
2608	return
2609}
2610
2611// updateDedicatedVmHost implements the OCIOperation interface (enables retrying operations)
2612func (client ComputeClient) updateDedicatedVmHost(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2613	httpRequest, err := request.HTTPRequest(http.MethodPut, "/dedicatedVmHosts/{dedicatedVmHostId}")
2614	if err != nil {
2615		return nil, err
2616	}
2617
2618	var response UpdateDedicatedVmHostResponse
2619	var httpResponse *http.Response
2620	httpResponse, err = client.Call(ctx, &httpRequest)
2621	defer common.CloseBodyIfValid(httpResponse)
2622	response.RawResponse = httpResponse
2623	if err != nil {
2624		return response, err
2625	}
2626
2627	err = common.UnmarshalResponse(httpResponse, &response)
2628	return response, err
2629}
2630
2631// UpdateImage Updates the display name of the image. Avoid entering confidential information.
2632func (client ComputeClient) UpdateImage(ctx context.Context, request UpdateImageRequest) (response UpdateImageResponse, err error) {
2633	var ociResponse common.OCIResponse
2634	policy := common.NoRetryPolicy()
2635	if request.RetryPolicy() != nil {
2636		policy = *request.RetryPolicy()
2637	}
2638
2639	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
2640		request.OpcRetryToken = common.String(common.RetryToken())
2641	}
2642
2643	ociResponse, err = common.Retry(ctx, request, client.updateImage, policy)
2644	if err != nil {
2645		if ociResponse != nil {
2646			response = UpdateImageResponse{RawResponse: ociResponse.HTTPResponse()}
2647		}
2648		return
2649	}
2650	if convertedResponse, ok := ociResponse.(UpdateImageResponse); ok {
2651		response = convertedResponse
2652	} else {
2653		err = fmt.Errorf("failed to convert OCIResponse into UpdateImageResponse")
2654	}
2655	return
2656}
2657
2658// updateImage implements the OCIOperation interface (enables retrying operations)
2659func (client ComputeClient) updateImage(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2660	httpRequest, err := request.HTTPRequest(http.MethodPut, "/images/{imageId}")
2661	if err != nil {
2662		return nil, err
2663	}
2664
2665	var response UpdateImageResponse
2666	var httpResponse *http.Response
2667	httpResponse, err = client.Call(ctx, &httpRequest)
2668	defer common.CloseBodyIfValid(httpResponse)
2669	response.RawResponse = httpResponse
2670	if err != nil {
2671		return response, err
2672	}
2673
2674	err = common.UnmarshalResponse(httpResponse, &response)
2675	return response, err
2676}
2677
2678// UpdateInstance Updates certain fields on the specified instance. Fields that are not provided in the
2679// request will not be updated. Avoid entering confidential information.
2680// Changes to metadata fields will be reflected in the instance metadata service (this may take
2681// up to a minute).
2682// The OCID of the instance remains the same.
2683func (client ComputeClient) UpdateInstance(ctx context.Context, request UpdateInstanceRequest) (response UpdateInstanceResponse, err error) {
2684	var ociResponse common.OCIResponse
2685	policy := common.NoRetryPolicy()
2686	if request.RetryPolicy() != nil {
2687		policy = *request.RetryPolicy()
2688	}
2689
2690	if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") {
2691		request.OpcRetryToken = common.String(common.RetryToken())
2692	}
2693
2694	ociResponse, err = common.Retry(ctx, request, client.updateInstance, policy)
2695	if err != nil {
2696		if ociResponse != nil {
2697			response = UpdateInstanceResponse{RawResponse: ociResponse.HTTPResponse()}
2698		}
2699		return
2700	}
2701	if convertedResponse, ok := ociResponse.(UpdateInstanceResponse); ok {
2702		response = convertedResponse
2703	} else {
2704		err = fmt.Errorf("failed to convert OCIResponse into UpdateInstanceResponse")
2705	}
2706	return
2707}
2708
2709// updateInstance implements the OCIOperation interface (enables retrying operations)
2710func (client ComputeClient) updateInstance(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {
2711	httpRequest, err := request.HTTPRequest(http.MethodPut, "/instances/{instanceId}")
2712	if err != nil {
2713		return nil, err
2714	}
2715
2716	var response UpdateInstanceResponse
2717	var httpResponse *http.Response
2718	httpResponse, err = client.Call(ctx, &httpRequest)
2719	defer common.CloseBodyIfValid(httpResponse)
2720	response.RawResponse = httpResponse
2721	if err != nil {
2722		return response, err
2723	}
2724
2725	err = common.UnmarshalResponse(httpResponse, &response)
2726	return response, err
2727}
2728