/* * 3DS OUTSCALE API * * Welcome to the 3DS OUTSCALE's API documentation.

The 3DS OUTSCALE API enables you to manage your resources in the 3DS OUTSCALE Cloud. This documentation describes the different actions available along with code examples.

Note that the 3DS OUTSCALE Cloud is compatible with Amazon Web Services (AWS) APIs, but some resources have different names in AWS than in the 3DS OUTSCALE API. You can find a list of the differences [here](https://wiki.outscale.net/display/EN/3DS+OUTSCALE+APIs+Reference).

You can also manage your resources using the [Cockpit](https://wiki.outscale.net/display/EN/About+Cockpit) web interface. * * API version: 1.2 * Contact: support@outscale.com * Generated by: OpenAPI Generator (https://openapi-generator.tech) */ package osc import ( _context "context" _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" "github.com/antihax/optional" ) // Linger please var ( _ _context.Context ) // SnapshotApiService SnapshotApi service type SnapshotApiService service // CreateSnapshotOpts Optional parameters for the method 'CreateSnapshot' type CreateSnapshotOpts struct { CreateSnapshotRequest optional.Interface } /* CreateSnapshot Method for CreateSnapshot * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *CreateSnapshotOpts - Optional Parameters: * @param "CreateSnapshotRequest" (optional.Interface of CreateSnapshotRequest) - @return CreateSnapshotResponse */ func (a *SnapshotApiService) CreateSnapshot(ctx _context.Context, localVarOptionals *CreateSnapshotOpts) (CreateSnapshotResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte localVarReturnValue CreateSnapshotResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/CreateSnapshot" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params if localVarOptionals != nil && localVarOptionals.CreateSnapshotRequest.IsSet() { localVarOptionalCreateSnapshotRequest, localVarOptionalCreateSnapshotRequestok := localVarOptionals.CreateSnapshotRequest.Value().(CreateSnapshotRequest) if !localVarOptionalCreateSnapshotRequestok { return localVarReturnValue, nil, reportError("createSnapshotRequest should be CreateSnapshotRequest") } localVarPostBody = &localVarOptionalCreateSnapshotRequest } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["Authorization"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(r) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 200 { var v CreateSnapshotResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 400 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 500 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, error: err.Error(), } return localVarReturnValue, localVarHTTPResponse, newErr } return localVarReturnValue, localVarHTTPResponse, nil } // CreateSnapshotExportTaskOpts Optional parameters for the method 'CreateSnapshotExportTask' type CreateSnapshotExportTaskOpts struct { CreateSnapshotExportTaskRequest optional.Interface } /* CreateSnapshotExportTask Method for CreateSnapshotExportTask * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *CreateSnapshotExportTaskOpts - Optional Parameters: * @param "CreateSnapshotExportTaskRequest" (optional.Interface of CreateSnapshotExportTaskRequest) - @return CreateSnapshotExportTaskResponse */ func (a *SnapshotApiService) CreateSnapshotExportTask(ctx _context.Context, localVarOptionals *CreateSnapshotExportTaskOpts) (CreateSnapshotExportTaskResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte localVarReturnValue CreateSnapshotExportTaskResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/CreateSnapshotExportTask" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params if localVarOptionals != nil && localVarOptionals.CreateSnapshotExportTaskRequest.IsSet() { localVarOptionalCreateSnapshotExportTaskRequest, localVarOptionalCreateSnapshotExportTaskRequestok := localVarOptionals.CreateSnapshotExportTaskRequest.Value().(CreateSnapshotExportTaskRequest) if !localVarOptionalCreateSnapshotExportTaskRequestok { return localVarReturnValue, nil, reportError("createSnapshotExportTaskRequest should be CreateSnapshotExportTaskRequest") } localVarPostBody = &localVarOptionalCreateSnapshotExportTaskRequest } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["Authorization"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(r) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 200 { var v CreateSnapshotExportTaskResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, error: err.Error(), } return localVarReturnValue, localVarHTTPResponse, newErr } return localVarReturnValue, localVarHTTPResponse, nil } // DeleteSnapshotOpts Optional parameters for the method 'DeleteSnapshot' type DeleteSnapshotOpts struct { DeleteSnapshotRequest optional.Interface } /* DeleteSnapshot Method for DeleteSnapshot * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *DeleteSnapshotOpts - Optional Parameters: * @param "DeleteSnapshotRequest" (optional.Interface of DeleteSnapshotRequest) - @return DeleteSnapshotResponse */ func (a *SnapshotApiService) DeleteSnapshot(ctx _context.Context, localVarOptionals *DeleteSnapshotOpts) (DeleteSnapshotResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte localVarReturnValue DeleteSnapshotResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/DeleteSnapshot" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params if localVarOptionals != nil && localVarOptionals.DeleteSnapshotRequest.IsSet() { localVarOptionalDeleteSnapshotRequest, localVarOptionalDeleteSnapshotRequestok := localVarOptionals.DeleteSnapshotRequest.Value().(DeleteSnapshotRequest) if !localVarOptionalDeleteSnapshotRequestok { return localVarReturnValue, nil, reportError("deleteSnapshotRequest should be DeleteSnapshotRequest") } localVarPostBody = &localVarOptionalDeleteSnapshotRequest } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["Authorization"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(r) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 200 { var v DeleteSnapshotResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 400 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 500 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, error: err.Error(), } return localVarReturnValue, localVarHTTPResponse, newErr } return localVarReturnValue, localVarHTTPResponse, nil } // ReadSnapshotExportTasksOpts Optional parameters for the method 'ReadSnapshotExportTasks' type ReadSnapshotExportTasksOpts struct { ReadSnapshotExportTasksRequest optional.Interface } /* ReadSnapshotExportTasks Method for ReadSnapshotExportTasks * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *ReadSnapshotExportTasksOpts - Optional Parameters: * @param "ReadSnapshotExportTasksRequest" (optional.Interface of ReadSnapshotExportTasksRequest) - @return ReadSnapshotExportTasksResponse */ func (a *SnapshotApiService) ReadSnapshotExportTasks(ctx _context.Context, localVarOptionals *ReadSnapshotExportTasksOpts) (ReadSnapshotExportTasksResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte localVarReturnValue ReadSnapshotExportTasksResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/ReadSnapshotExportTasks" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params if localVarOptionals != nil && localVarOptionals.ReadSnapshotExportTasksRequest.IsSet() { localVarOptionalReadSnapshotExportTasksRequest, localVarOptionalReadSnapshotExportTasksRequestok := localVarOptionals.ReadSnapshotExportTasksRequest.Value().(ReadSnapshotExportTasksRequest) if !localVarOptionalReadSnapshotExportTasksRequestok { return localVarReturnValue, nil, reportError("readSnapshotExportTasksRequest should be ReadSnapshotExportTasksRequest") } localVarPostBody = &localVarOptionalReadSnapshotExportTasksRequest } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["Authorization"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(r) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 200 { var v ReadSnapshotExportTasksResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, error: err.Error(), } return localVarReturnValue, localVarHTTPResponse, newErr } return localVarReturnValue, localVarHTTPResponse, nil } // ReadSnapshotsOpts Optional parameters for the method 'ReadSnapshots' type ReadSnapshotsOpts struct { ReadSnapshotsRequest optional.Interface } /* ReadSnapshots Method for ReadSnapshots * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *ReadSnapshotsOpts - Optional Parameters: * @param "ReadSnapshotsRequest" (optional.Interface of ReadSnapshotsRequest) - @return ReadSnapshotsResponse */ func (a *SnapshotApiService) ReadSnapshots(ctx _context.Context, localVarOptionals *ReadSnapshotsOpts) (ReadSnapshotsResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte localVarReturnValue ReadSnapshotsResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/ReadSnapshots" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params if localVarOptionals != nil && localVarOptionals.ReadSnapshotsRequest.IsSet() { localVarOptionalReadSnapshotsRequest, localVarOptionalReadSnapshotsRequestok := localVarOptionals.ReadSnapshotsRequest.Value().(ReadSnapshotsRequest) if !localVarOptionalReadSnapshotsRequestok { return localVarReturnValue, nil, reportError("readSnapshotsRequest should be ReadSnapshotsRequest") } localVarPostBody = &localVarOptionalReadSnapshotsRequest } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["Authorization"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(r) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 200 { var v ReadSnapshotsResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 400 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 500 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, error: err.Error(), } return localVarReturnValue, localVarHTTPResponse, newErr } return localVarReturnValue, localVarHTTPResponse, nil } // UpdateSnapshotOpts Optional parameters for the method 'UpdateSnapshot' type UpdateSnapshotOpts struct { UpdateSnapshotRequest optional.Interface } /* UpdateSnapshot Method for UpdateSnapshot * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *UpdateSnapshotOpts - Optional Parameters: * @param "UpdateSnapshotRequest" (optional.Interface of UpdateSnapshotRequest) - @return UpdateSnapshotResponse */ func (a *SnapshotApiService) UpdateSnapshot(ctx _context.Context, localVarOptionals *UpdateSnapshotOpts) (UpdateSnapshotResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte localVarReturnValue UpdateSnapshotResponse ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/UpdateSnapshot" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params if localVarOptionals != nil && localVarOptionals.UpdateSnapshotRequest.IsSet() { localVarOptionalUpdateSnapshotRequest, localVarOptionalUpdateSnapshotRequestok := localVarOptionals.UpdateSnapshotRequest.Value().(UpdateSnapshotRequest) if !localVarOptionalUpdateSnapshotRequestok { return localVarReturnValue, nil, reportError("updateSnapshotRequest should be UpdateSnapshotRequest") } localVarPostBody = &localVarOptionalUpdateSnapshotRequest } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["Authorization"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(r) if err != nil || localVarHTTPResponse == nil { return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 200 { var v UpdateSnapshotResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 400 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 500 { var v ErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := GenericOpenAPIError{ body: localVarBody, error: err.Error(), } return localVarReturnValue, localVarHTTPResponse, newErr } return localVarReturnValue, localVarHTTPResponse, nil }