All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nutanix.net.java.client.api.VirtualSwitchApi Maven / Gradle / Ivy

Go to download

Manage networking configuration on Nutanix clusters, including AHV and advanced networking.

There is a newer version: 4.0.2-beta-1
Show newest version
package com.nutanix.net.java.client.api;

import com.nutanix.net.java.client.ApiClient;




import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

@javax.annotation.Generated(value = "com.nutanix.swagger.codegen.generators.JavaClientSDKGenerator", date = "2023-02-01T08:24:43.584Z[Etc/UTC]")@Component("com.nutanix.net.java.client.api.VirtualSwitchApi")
public class VirtualSwitchApi {
    private ApiClient apiClient;

    public VirtualSwitchApi() {
        this(new ApiClient());
    }

    @Autowired
    public VirtualSwitchApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Create a Virtual Switch
     * 

202 - Task Id corresponding to the Create Virtual Switch operation *

4XX - Client error response *

5XX - Server error response * @param body Schema to configure a virtual switch * @param xClusterId Prism Element Cluster UUID * @param args Additional arguments * @return com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse * @throws RestClientException if an error occurs while attempting to invoke the API */ public com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse createVirtualSwitch(com.nutanix.dp1.net.networking.v4.config.VirtualSwitch body, String xClusterId, HashMap ... args) throws RestClientException { // Check for optional argument map HashMap argMap = args.length > 0 ? args[0] : new HashMap(); Object postBody = body; // verify the required parameter 'body' is set if (body == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling createVirtualSwitch"); } // verify the required parameter 'xClusterId' is set if (xClusterId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'xClusterId' when calling createVirtualSwitch"); } String path = UriComponentsBuilder.fromPath("/api/networking/v4.0.a1/config/virtual-switches").build().toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); if (!CollectionUtils.isEmpty(argMap)) { if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) { headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH))); } if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) { headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH))); } } if (xClusterId != null) headerParams.add("X-Cluster-Id", apiClient.parameterToString(xClusterId)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { "application/json" }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicAuthScheme" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } /** * Delete a Virtual Switch *

202 - Task Id corresponding to the Delete Virtual Switches operation *

4XX - Client error response *

5XX - Server error response * @param xClusterId Prism Element Cluster UUID * @param extId UUID of Virtual Switch * @param args Additional arguments * @return com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse * @throws RestClientException if an error occurs while attempting to invoke the API */ public com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse deleteVirtualSwitch(String xClusterId, String extId, HashMap ... args) throws RestClientException { // Check for optional argument map HashMap argMap = args.length > 0 ? args[0] : new HashMap(); Object postBody = null; // verify the required parameter 'xClusterId' is set if (xClusterId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'xClusterId' when calling deleteVirtualSwitch"); } // verify the required parameter 'extId' is set if (extId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'extId' when calling deleteVirtualSwitch"); } // create path and map variables final Map uriVariables = new HashMap(); uriVariables.put("extId", extId); String path = UriComponentsBuilder.fromPath("/api/networking/v4.0.a1/config/virtual-switches/{extId}").buildAndExpand(uriVariables).toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); if (!CollectionUtils.isEmpty(argMap)) { if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) { headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH))); } if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) { headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH))); } } if (xClusterId != null) headerParams.add("X-Cluster-Id", apiClient.parameterToString(xClusterId)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicAuthScheme" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } /** * Get single Virtual Switch given its UUID *

200 - Virtual Switch queried *

4XX - Client error response *

5XX - Server error response * @param xClusterId Prism Element Cluster UUID * @param extId UUID of Virtual Switch * @param args Additional arguments * @return com.nutanix.dp1.net.networking.v4.config.VirtualSwitchApiResponse * @throws RestClientException if an error occurs while attempting to invoke the API */ public com.nutanix.dp1.net.networking.v4.config.VirtualSwitchApiResponse getVirtualSwitch(String xClusterId, String extId, HashMap ... args) throws RestClientException { // Check for optional argument map HashMap argMap = args.length > 0 ? args[0] : new HashMap(); Object postBody = null; // verify the required parameter 'xClusterId' is set if (xClusterId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'xClusterId' when calling getVirtualSwitch"); } // verify the required parameter 'extId' is set if (extId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'extId' when calling getVirtualSwitch"); } // create path and map variables final Map uriVariables = new HashMap(); uriVariables.put("extId", extId); String path = UriComponentsBuilder.fromPath("/api/networking/v4.0.a1/config/virtual-switches/{extId}").buildAndExpand(uriVariables).toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); if (!CollectionUtils.isEmpty(argMap)) { if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) { headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH))); } if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) { headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH))); } } if (xClusterId != null) headerParams.add("X-Cluster-Id", apiClient.parameterToString(xClusterId)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicAuthScheme" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } /** * Get list of Virtual Switches *

200 - List of virtual switches queries *

4XX - Client error response *

5XX - Server error response * @param xClusterId Prism Element Cluster UUID * @param args Additional arguments * @return com.nutanix.dp1.net.networking.v4.config.VirtualSwitchListApiResponse * @throws RestClientException if an error occurs while attempting to invoke the API */ public com.nutanix.dp1.net.networking.v4.config.VirtualSwitchListApiResponse listVirtualSwitches(String xClusterId, HashMap ... args) throws RestClientException { // Check for optional argument map HashMap argMap = args.length > 0 ? args[0] : new HashMap(); Object postBody = null; // verify the required parameter 'xClusterId' is set if (xClusterId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'xClusterId' when calling listVirtualSwitches"); } String path = UriComponentsBuilder.fromPath("/api/networking/v4.0.a1/config/virtual-switches").build().toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); if (!CollectionUtils.isEmpty(argMap)) { if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) { headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH))); } if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) { headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH))); } } if (xClusterId != null) headerParams.add("X-Cluster-Id", apiClient.parameterToString(xClusterId)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicAuthScheme" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } /** * Update a Virtual Switch *

202 - Task Id corresponding to the Update Virtual Switches operation *

4XX - Client error response *

5XX - Server error response * @param body Schema to configure a virtual switch * @param xClusterId Prism Element Cluster UUID * @param extId UUID of Virtual Switch * @param args Additional arguments * @return com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse * @throws RestClientException if an error occurs while attempting to invoke the API */ public com.nutanix.dp1.net.networking.v4.config.TaskReferenceApiResponse updateVirtualSwitch(com.nutanix.dp1.net.networking.v4.config.VirtualSwitch body, String xClusterId, String extId, HashMap ... args) throws RestClientException { // Check for optional argument map HashMap argMap = args.length > 0 ? args[0] : new HashMap(); Object postBody = body; // verify the required parameter 'body' is set if (body == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling updateVirtualSwitch"); } // verify the required parameter 'xClusterId' is set if (xClusterId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'xClusterId' when calling updateVirtualSwitch"); } // verify the required parameter 'extId' is set if (extId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'extId' when calling updateVirtualSwitch"); } // create path and map variables final Map uriVariables = new HashMap(); uriVariables.put("extId", extId); String path = UriComponentsBuilder.fromPath("/api/networking/v4.0.a1/config/virtual-switches/{extId}").buildAndExpand(uriVariables).toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); if (!CollectionUtils.isEmpty(argMap)) { if (argMap.containsKey(HttpHeaders.IF_MATCH) && argMap.get(HttpHeaders.IF_MATCH)!=null) { headerParams.add(HttpHeaders.IF_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_MATCH))); } if (argMap.containsKey(HttpHeaders.IF_NONE_MATCH) && argMap.get(HttpHeaders.IF_NONE_MATCH)!=null) { headerParams.add(HttpHeaders.IF_NONE_MATCH, apiClient.parameterToString(argMap.get(HttpHeaders.IF_NONE_MATCH))); } } if (xClusterId != null) headerParams.add("X-Cluster-Id", apiClient.parameterToString(xClusterId)); final String[] accepts = { "application/json" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { "application/json" }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicAuthScheme" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy