From 461f3c70dfbdf49a177a83405630a6dd215971c3 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Wed, 1 Apr 2026 06:58:13 +0000 Subject: [PATCH] Generate sfs --- services/sfs/oas_commit | 2 +- .../main/java/cloud/stackit/sdk/sfs/JSON.java | 21 + .../cloud/stackit/sdk/sfs/api/DefaultApi.java | 1609 ++++++++++++++--- .../sdk/sfs/model/CreateLockResponse.java | 295 +++ .../sfs/model/CreateResourcePoolPayload.java | 37 + .../CreateResourcePoolSnapshotPayload.java | 36 +- .../sdk/sfs/model/GetScheduleResponse.java | 291 +++ .../sfs/model/GetSnapshotPolicyResponse.java | 293 +++ .../sdk/sfs/model/ListSchedulesResponse.java | 316 ++++ .../model/ListSnapshotPoliciesResponse.java | 327 ++++ .../stackit/sdk/sfs/model/ResourcePool.java | 50 + .../sdk/sfs/model/ResourcePoolSnapshot.java | 31 + .../sfs/model/ResourcePoolSnapshotPolicy.java | 329 ++++ .../sdk/sfs/model/ResourcePoolSpace.java | 44 +- .../cloud/stackit/sdk/sfs/model/Schedule.java | 385 ++++ .../stackit/sdk/sfs/model/SnapshotPolicy.java | 468 +++++ .../sdk/sfs/model/SnapshotPolicySchedule.java | 389 ++++ .../sfs/model/UpdateResourcePoolPayload.java | 38 + 18 files changed, 4673 insertions(+), 288 deletions(-) create mode 100644 services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateLockResponse.java create mode 100644 services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/GetScheduleResponse.java create mode 100644 services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/GetSnapshotPolicyResponse.java create mode 100644 services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ListSchedulesResponse.java create mode 100644 services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ListSnapshotPoliciesResponse.java create mode 100644 services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSnapshotPolicy.java create mode 100644 services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/Schedule.java create mode 100644 services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/SnapshotPolicy.java create mode 100644 services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/SnapshotPolicySchedule.java diff --git a/services/sfs/oas_commit b/services/sfs/oas_commit index 5c20c20..e8627c8 100644 --- a/services/sfs/oas_commit +++ b/services/sfs/oas_commit @@ -1 +1 @@ -fe212a12ec79a23b81cb53d9a7728f5706bddc23 +6a86f80df68ab686dfa9409cfb4208c59fd68aec diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/JSON.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/JSON.java index 07f8f3d..ab28bb6 100644 --- a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/JSON.java +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/JSON.java @@ -95,6 +95,8 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.sfs.model.CreateLockResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.CreateResourcePoolPayload .CustomTypeAdapterFactory()); @@ -127,11 +129,16 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.GetResourcePoolSnapshotResponse .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.sfs.model.GetScheduleResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.GetShareExportPolicyResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.GetShareResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.sfs.model.GetSnapshotPolicyResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.GoogleProtobufAny.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( @@ -143,11 +150,16 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.ListResourcePoolsResponse .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.sfs.model.ListSchedulesResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.ListShareExportPoliciesResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.ListSharesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.sfs.model.ListSnapshotPoliciesResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.PerformanceClass.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( @@ -157,14 +169,23 @@ private static Class getClassByDiscriminator( .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.ResourcePoolSnapshot.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.sfs.model.ResourcePoolSnapshotPolicy + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.ResourcePoolSpace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.sfs.model.Schedule.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.Share.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.ShareExportPolicy.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.ShareExportPolicyRule.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.sfs.model.SnapshotPolicy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.sfs.model.SnapshotPolicySchedule.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.sfs.model.Status.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/api/DefaultApi.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/api/DefaultApi.java index 12c1ed1..ce8f4aa 100644 --- a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/api/DefaultApi.java +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/api/DefaultApi.java @@ -18,6 +18,7 @@ import cloud.stackit.sdk.sfs.ApiClient; import cloud.stackit.sdk.sfs.ApiResponse; import cloud.stackit.sdk.sfs.Pair; +import cloud.stackit.sdk.sfs.model.CreateLockResponse; import cloud.stackit.sdk.sfs.model.CreateResourcePoolPayload; import cloud.stackit.sdk.sfs.model.CreateResourcePoolResponse; import cloud.stackit.sdk.sfs.model.CreateResourcePoolSnapshotPayload; @@ -28,13 +29,17 @@ import cloud.stackit.sdk.sfs.model.CreateShareResponse; import cloud.stackit.sdk.sfs.model.GetResourcePoolResponse; import cloud.stackit.sdk.sfs.model.GetResourcePoolSnapshotResponse; +import cloud.stackit.sdk.sfs.model.GetScheduleResponse; import cloud.stackit.sdk.sfs.model.GetShareExportPolicyResponse; import cloud.stackit.sdk.sfs.model.GetShareResponse; +import cloud.stackit.sdk.sfs.model.GetSnapshotPolicyResponse; import cloud.stackit.sdk.sfs.model.ListPerformanceClassesResponse; import cloud.stackit.sdk.sfs.model.ListResourcePoolSnapshotsResponse; import cloud.stackit.sdk.sfs.model.ListResourcePoolsResponse; +import cloud.stackit.sdk.sfs.model.ListSchedulesResponse; import cloud.stackit.sdk.sfs.model.ListShareExportPoliciesResponse; import cloud.stackit.sdk.sfs.model.ListSharesResponse; +import cloud.stackit.sdk.sfs.model.ListSnapshotPoliciesResponse; import cloud.stackit.sdk.sfs.model.UpdateResourcePoolPayload; import cloud.stackit.sdk.sfs.model.UpdateResourcePoolResponse; import cloud.stackit.sdk.sfs.model.UpdateShareExportPolicyPayload; @@ -127,6 +132,183 @@ public void setCustomBaseUrl(String customBaseUrl) { this.localCustomBaseUrl = customBaseUrl; } + /** + * Build call for createLock + * + * @param region (required) + * @param projectId (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public okhttp3.Call createLockCall( + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String projectId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/regions/{region}/project/{projectId}/locks" + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createLockValidateBeforeCall( + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String projectId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createLock(Async)"); + } + + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling createLock(Async)"); + } + + return createLockCall(region, projectId, _callback); + } + + /** + * Create Lock + * + * @param region (required) + * @param projectId (required) + * @return CreateLockResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public CreateLockResponse createLock( + @javax.annotation.Nonnull String region, @javax.annotation.Nonnull String projectId) + throws ApiException { + ApiResponse localVarResp = createLockWithHttpInfo(region, projectId); + return localVarResp.getData(); + } + + /** + * Create Lock + * + * @param region (required) + * @param projectId (required) + * @return ApiResponse<CreateLockResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public ApiResponse createLockWithHttpInfo( + @javax.annotation.Nonnull String region, @javax.annotation.Nonnull String projectId) + throws ApiException { + okhttp3.Call localVarCall = createLockValidateBeforeCall(region, projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) Create Lock + * + * @param region (required) + * @param projectId (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public okhttp3.Call createLockAsync( + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String projectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = createLockValidateBeforeCall(region, projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** * Build call for createResourcePool * @@ -1015,11 +1197,10 @@ public okhttp3.Call createShareExportPolicyAsync( } /** - * Build call for deleteResourcePool + * Build call for deleteLock * - * @param projectId (required) * @param region (required) - * @param resourcePoolId (required) + * @param projectId (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1028,15 +1209,12 @@ public okhttp3.Call createShareExportPolicyAsync( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public okhttp3.Call deleteResourcePoolCall( - @javax.annotation.Nonnull String projectId, + public okhttp3.Call deleteLockCall( @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId, + @javax.annotation.Nonnull String projectId, final ApiCallback _callback) throws ApiException { String basePath = null; @@ -1056,16 +1234,13 @@ public okhttp3.Call deleteResourcePoolCall( // create path and map variables String localVarPath = - "/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) + "/v1/regions/{region}/project/{projectId}/locks" .replace( "{" + "region" + "}", localVarApiClient.escapeString(region.toString())) .replace( - "{" + "resourcePoolId" + "}", - localVarApiClient.escapeString(resourcePoolId.toString())); + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1073,9 +1248,7 @@ public okhttp3.Call deleteResourcePoolCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { - "application/json", "application/problem+json", "text/plain" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); @@ -1104,39 +1277,31 @@ public okhttp3.Call deleteResourcePoolCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteResourcePoolValidateBeforeCall( - @javax.annotation.Nonnull String projectId, + private okhttp3.Call deleteLockValidateBeforeCall( @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId, + @javax.annotation.Nonnull String projectId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling deleteResourcePool(Async)"); - } - // verify the required parameter 'region' is set if (region == null) { throw new ApiException( - "Missing the required parameter 'region' when calling deleteResourcePool(Async)"); + "Missing the required parameter 'region' when calling deleteLock(Async)"); } - // verify the required parameter 'resourcePoolId' is set - if (resourcePoolId == null) { + // verify the required parameter 'projectId' is set + if (projectId == null) { throw new ApiException( - "Missing the required parameter 'resourcePoolId' when calling deleteResourcePool(Async)"); + "Missing the required parameter 'projectId' when calling deleteLock(Async)"); } - return deleteResourcePoolCall(projectId, region, resourcePoolId, _callback); + return deleteLockCall(region, projectId, _callback); } /** - * Delete Resource Pool Deletes a Resource Pool in a project. + * Delete Lock * - * @param projectId (required) * @param region (required) - * @param resourcePoolId (required) + * @param projectId (required) * @return Object * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body @@ -1145,27 +1310,21 @@ private okhttp3.Call deleteResourcePoolValidateBeforeCall( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public Object deleteResourcePool( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId) + public Object deleteLock( + @javax.annotation.Nonnull String region, @javax.annotation.Nonnull String projectId) throws ApiException { - ApiResponse localVarResp = - deleteResourcePoolWithHttpInfo(projectId, region, resourcePoolId); + ApiResponse localVarResp = deleteLockWithHttpInfo(region, projectId); return localVarResp.getData(); } /** - * Delete Resource Pool Deletes a Resource Pool in a project. + * Delete Lock * - * @param projectId (required) * @param region (required) - * @param resourcePoolId (required) + * @param projectId (required) * @return ApiResponse<Object> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body @@ -1174,28 +1333,22 @@ public Object deleteResourcePool( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public ApiResponse deleteResourcePoolWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId) + public ApiResponse deleteLockWithHttpInfo( + @javax.annotation.Nonnull String region, @javax.annotation.Nonnull String projectId) throws ApiException { - okhttp3.Call localVarCall = - deleteResourcePoolValidateBeforeCall(projectId, region, resourcePoolId, null); + okhttp3.Call localVarCall = deleteLockValidateBeforeCall(region, projectId, null); Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Delete Resource Pool (asynchronously) Deletes a Resource Pool in a project. + * (asynchronously) Delete Lock * - * @param projectId (required) * @param region (required) - * @param resourcePoolId (required) + * @param projectId (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body @@ -1205,32 +1358,27 @@ public ApiResponse deleteResourcePoolWithHttpInfo( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public okhttp3.Call deleteResourcePoolAsync( - @javax.annotation.Nonnull String projectId, + public okhttp3.Call deleteLockAsync( @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId, + @javax.annotation.Nonnull String projectId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - deleteResourcePoolValidateBeforeCall(projectId, region, resourcePoolId, _callback); + okhttp3.Call localVarCall = deleteLockValidateBeforeCall(region, projectId, _callback); Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for deleteResourcePoolSnapshot + * Build call for deleteResourcePool * * @param projectId (required) * @param region (required) * @param resourcePoolId (required) - * @param snapshotName (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1244,11 +1392,10 @@ public okhttp3.Call deleteResourcePoolAsync( * 500 Please retry again later or contact support if the issue persists - * */ - public okhttp3.Call deleteResourcePoolSnapshotCall( + public okhttp3.Call deleteResourcePoolCall( @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String region, @javax.annotation.Nonnull String resourcePoolId, - @javax.annotation.Nonnull String snapshotName, final ApiCallback _callback) throws ApiException { String basePath = null; @@ -1268,7 +1415,7 @@ public okhttp3.Call deleteResourcePoolSnapshotCall( // create path and map variables String localVarPath = - "/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots/{snapshotName}" + "/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}" .replace( "{" + "projectId" + "}", localVarApiClient.escapeString(projectId.toString())) @@ -1277,10 +1424,7 @@ public okhttp3.Call deleteResourcePoolSnapshotCall( localVarApiClient.escapeString(region.toString())) .replace( "{" + "resourcePoolId" + "}", - localVarApiClient.escapeString(resourcePoolId.toString())) - .replace( - "{" + "snapshotName" + "}", - localVarApiClient.escapeString(snapshotName.toString())); + localVarApiClient.escapeString(resourcePoolId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1319,39 +1463,254 @@ public okhttp3.Call deleteResourcePoolSnapshotCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteResourcePoolSnapshotValidateBeforeCall( + private okhttp3.Call deleteResourcePoolValidateBeforeCall( @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String region, @javax.annotation.Nonnull String resourcePoolId, - @javax.annotation.Nonnull String snapshotName, final ApiCallback _callback) throws ApiException { // verify the required parameter 'projectId' is set if (projectId == null) { throw new ApiException( - "Missing the required parameter 'projectId' when calling deleteResourcePoolSnapshot(Async)"); + "Missing the required parameter 'projectId' when calling deleteResourcePool(Async)"); } // verify the required parameter 'region' is set if (region == null) { throw new ApiException( - "Missing the required parameter 'region' when calling deleteResourcePoolSnapshot(Async)"); + "Missing the required parameter 'region' when calling deleteResourcePool(Async)"); } // verify the required parameter 'resourcePoolId' is set if (resourcePoolId == null) { throw new ApiException( - "Missing the required parameter 'resourcePoolId' when calling deleteResourcePoolSnapshot(Async)"); - } - - // verify the required parameter 'snapshotName' is set - if (snapshotName == null) { - throw new ApiException( - "Missing the required parameter 'snapshotName' when calling deleteResourcePoolSnapshot(Async)"); + "Missing the required parameter 'resourcePoolId' when calling deleteResourcePool(Async)"); } - return deleteResourcePoolSnapshotCall( - projectId, region, resourcePoolId, snapshotName, _callback); + return deleteResourcePoolCall(projectId, region, resourcePoolId, _callback); + } + + /** + * Delete Resource Pool Deletes a Resource Pool in a project. + * + * @param projectId (required) + * @param region (required) + * @param resourcePoolId (required) + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public Object deleteResourcePool( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId) + throws ApiException { + ApiResponse localVarResp = + deleteResourcePoolWithHttpInfo(projectId, region, resourcePoolId); + return localVarResp.getData(); + } + + /** + * Delete Resource Pool Deletes a Resource Pool in a project. + * + * @param projectId (required) + * @param region (required) + * @param resourcePoolId (required) + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public ApiResponse deleteResourcePoolWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId) + throws ApiException { + okhttp3.Call localVarCall = + deleteResourcePoolValidateBeforeCall(projectId, region, resourcePoolId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Resource Pool (asynchronously) Deletes a Resource Pool in a project. + * + * @param projectId (required) + * @param region (required) + * @param resourcePoolId (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public okhttp3.Call deleteResourcePoolAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteResourcePoolValidateBeforeCall(projectId, region, resourcePoolId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteResourcePoolSnapshot + * + * @param projectId (required) + * @param region (required) + * @param resourcePoolId (required) + * @param snapshotName (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public okhttp3.Call deleteResourcePoolSnapshotCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId, + @javax.annotation.Nonnull String snapshotName, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots/{snapshotName}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "resourcePoolId" + "}", + localVarApiClient.escapeString(resourcePoolId.toString())) + .replace( + "{" + "snapshotName" + "}", + localVarApiClient.escapeString(snapshotName.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/problem+json", "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteResourcePoolSnapshotValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId, + @javax.annotation.Nonnull String snapshotName, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling deleteResourcePoolSnapshot(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteResourcePoolSnapshot(Async)"); + } + + // verify the required parameter 'resourcePoolId' is set + if (resourcePoolId == null) { + throw new ApiException( + "Missing the required parameter 'resourcePoolId' when calling deleteResourcePoolSnapshot(Async)"); + } + + // verify the required parameter 'snapshotName' is set + if (snapshotName == null) { + throw new ApiException( + "Missing the required parameter 'snapshotName' when calling deleteResourcePoolSnapshot(Async)"); + } + + return deleteResourcePoolSnapshotCall( + projectId, region, resourcePoolId, snapshotName, _callback); } /** @@ -2341,12 +2700,10 @@ public okhttp3.Call getResourcePoolSnapshotAsync( } /** - * Build call for getShare + * Build call for getSchedule * * @param projectId (required) - * @param region (required) - * @param resourcePoolId (required) - * @param shareId (required) + * @param id (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2355,16 +2712,12 @@ public okhttp3.Call getResourcePoolSnapshotAsync( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public okhttp3.Call getShareCall( + public okhttp3.Call getScheduleCall( @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId, - @javax.annotation.Nonnull String shareId, + @javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { String basePath = null; @@ -2384,19 +2737,11 @@ public okhttp3.Call getShareCall( // create path and map variables String localVarPath = - "/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares/{shareId}" + "/v1/projects/{projectId}/schedules/{id}" .replace( "{" + "projectId" + "}", localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "region" + "}", - localVarApiClient.escapeString(region.toString())) - .replace( - "{" + "resourcePoolId" + "}", - localVarApiClient.escapeString(resourcePoolId.toString())) - .replace( - "{" + "shareId" + "}", - localVarApiClient.escapeString(shareId.toString())); + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -2404,9 +2749,7 @@ public okhttp3.Call getShareCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { - "application/json", "application/problem+json", "text/plain" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); @@ -2435,26 +2778,217 @@ public okhttp3.Call getShareCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call getShareValidateBeforeCall( + private okhttp3.Call getScheduleValidateBeforeCall( @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId, - @javax.annotation.Nonnull String shareId, + @javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { // verify the required parameter 'projectId' is set if (projectId == null) { throw new ApiException( - "Missing the required parameter 'projectId' when calling getShare(Async)"); + "Missing the required parameter 'projectId' when calling getSchedule(Async)"); } - // verify the required parameter 'region' is set - if (region == null) { + // verify the required parameter 'id' is set + if (id == null) { throw new ApiException( - "Missing the required parameter 'region' when calling getShare(Async)"); + "Missing the required parameter 'id' when calling getSchedule(Async)"); } - // verify the required parameter 'resourcePoolId' is set + return getScheduleCall(projectId, id, _callback); + } + + /** + * Get Schedule + * + * @param projectId (required) + * @param id (required) + * @return GetScheduleResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public GetScheduleResponse getSchedule( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String id) + throws ApiException { + ApiResponse localVarResp = getScheduleWithHttpInfo(projectId, id); + return localVarResp.getData(); + } + + /** + * Get Schedule + * + * @param projectId (required) + * @param id (required) + * @return ApiResponse<GetScheduleResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public ApiResponse getScheduleWithHttpInfo( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String id) + throws ApiException { + okhttp3.Call localVarCall = getScheduleValidateBeforeCall(projectId, id, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) Get Schedule + * + * @param projectId (required) + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public okhttp3.Call getScheduleAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String id, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getScheduleValidateBeforeCall(projectId, id, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getShare + * + * @param projectId (required) + * @param region (required) + * @param resourcePoolId (required) + * @param shareId (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public okhttp3.Call getShareCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId, + @javax.annotation.Nonnull String shareId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares/{shareId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "resourcePoolId" + "}", + localVarApiClient.escapeString(resourcePoolId.toString())) + .replace( + "{" + "shareId" + "}", + localVarApiClient.escapeString(shareId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/problem+json", "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getShareValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId, + @javax.annotation.Nonnull String shareId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling getShare(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getShare(Async)"); + } + + // verify the required parameter 'resourcePoolId' is set if (resourcePoolId == null) { throw new ApiException( "Missing the required parameter 'resourcePoolId' when calling getShare(Async)"); @@ -2780,8 +3314,10 @@ public okhttp3.Call getShareExportPolicyAsync( } /** - * Build call for listPerformanceClasses + * Build call for getSnapshotPolicy * + * @param projectId (required) + * @param id (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2790,12 +3326,13 @@ public okhttp3.Call getShareExportPolicyAsync( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public okhttp3.Call listPerformanceClassesCall(final ApiCallback _callback) + public okhttp3.Call getSnapshotPolicyCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String id, + final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -2813,7 +3350,12 @@ public okhttp3.Call listPerformanceClassesCall(final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = "/v1/resourcePoolPerformanceClasses"; + String localVarPath = + "/v1/projects/{projectId}/snapshotPolicies/{id}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -2821,9 +3363,7 @@ public okhttp3.Call listPerformanceClassesCall(final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { - "application/json", "application/problem+json", "text/plain" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); @@ -2852,15 +3392,32 @@ public okhttp3.Call listPerformanceClassesCall(final ApiCallback _callback) } @SuppressWarnings("rawtypes") - private okhttp3.Call listPerformanceClassesValidateBeforeCall(final ApiCallback _callback) + private okhttp3.Call getSnapshotPolicyValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String id, + final ApiCallback _callback) throws ApiException { - return listPerformanceClassesCall(_callback); + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling getSnapshotPolicy(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + "Missing the required parameter 'id' when calling getSnapshotPolicy(Async)"); + } + + return getSnapshotPolicyCall(projectId, id, _callback); } /** - * List Resource Pool Performance Classes Lists all performances classes available + * Get Snapshot Policy * - * @return ListPerformanceClassesResponse + * @param projectId (required) + * @param id (required) + * @return GetSnapshotPolicyResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -2868,21 +3425,23 @@ private okhttp3.Call listPerformanceClassesValidateBeforeCall(final ApiCallback * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public ListPerformanceClassesResponse listPerformanceClasses() throws ApiException { - ApiResponse localVarResp = - listPerformanceClassesWithHttpInfo(); + public GetSnapshotPolicyResponse getSnapshotPolicy( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String id) + throws ApiException { + ApiResponse localVarResp = + getSnapshotPolicyWithHttpInfo(projectId, id); return localVarResp.getData(); } /** - * List Resource Pool Performance Classes Lists all performances classes available + * Get Snapshot Policy * - * @return ApiResponse<ListPerformanceClassesResponse> + * @param projectId (required) + * @param id (required) + * @return ApiResponse<GetSnapshotPolicyResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -2890,22 +3449,22 @@ public ListPerformanceClassesResponse listPerformanceClasses() throws ApiExcepti * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public ApiResponse listPerformanceClassesWithHttpInfo() + public ApiResponse getSnapshotPolicyWithHttpInfo( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String id) throws ApiException { - okhttp3.Call localVarCall = listPerformanceClassesValidateBeforeCall(null); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = getSnapshotPolicyValidateBeforeCall(projectId, id, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Resource Pool Performance Classes (asynchronously) Lists all performances classes - * available + * (asynchronously) Get Snapshot Policy * + * @param projectId (required) + * @param id (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body @@ -2915,26 +3474,24 @@ public ApiResponse listPerformanceClassesWithHtt * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public okhttp3.Call listPerformanceClassesAsync( - final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSnapshotPolicyAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String id, + final ApiCallback _callback) + throws ApiException { - okhttp3.Call localVarCall = listPerformanceClassesValidateBeforeCall(_callback); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = getSnapshotPolicyValidateBeforeCall(projectId, id, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for listResourcePoolSnapshots + * Build call for listPerformanceClasses * - * @param projectId (required) - * @param region (required) - * @param resourcePoolId (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2948,11 +3505,7 @@ public okhttp3.Call listPerformanceClassesAsync( * 500 Please retry again later or contact support if the issue persists - * */ - public okhttp3.Call listResourcePoolSnapshotsCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId, - final ApiCallback _callback) + public okhttp3.Call listPerformanceClassesCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -2970,17 +3523,7 @@ public okhttp3.Call listResourcePoolSnapshotsCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "region" + "}", - localVarApiClient.escapeString(region.toString())) - .replace( - "{" + "resourcePoolId" + "}", - localVarApiClient.escapeString(resourcePoolId.toString())); + String localVarPath = "/v1/resourcePoolPerformanceClasses"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -3019,14 +3562,180 @@ public okhttp3.Call listResourcePoolSnapshotsCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call listResourcePoolSnapshotsValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId, - final ApiCallback _callback) + private okhttp3.Call listPerformanceClassesValidateBeforeCall(final ApiCallback _callback) throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { + return listPerformanceClassesCall(_callback); + } + + /** + * List Resource Performance Classes Lists all performances classes available + * + * @return ListPerformanceClassesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public ListPerformanceClassesResponse listPerformanceClasses() throws ApiException { + ApiResponse localVarResp = + listPerformanceClassesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * List Resource Performance Classes Lists all performances classes available + * + * @return ApiResponse<ListPerformanceClassesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public ApiResponse listPerformanceClassesWithHttpInfo() + throws ApiException { + okhttp3.Call localVarCall = listPerformanceClassesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Resource Performance Classes (asynchronously) Lists all performances classes available + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public okhttp3.Call listPerformanceClassesAsync( + final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listPerformanceClassesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listResourcePoolSnapshots + * + * @param projectId (required) + * @param region (required) + * @param resourcePoolId (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public okhttp3.Call listResourcePoolSnapshotsCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "resourcePoolId" + "}", + localVarApiClient.escapeString(resourcePoolId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/problem+json", "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listResourcePoolSnapshotsValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { throw new ApiException( "Missing the required parameter 'projectId' when calling listResourcePoolSnapshots(Async)"); } @@ -3034,25 +3743,225 @@ private okhttp3.Call listResourcePoolSnapshotsValidateBeforeCall( // verify the required parameter 'region' is set if (region == null) { throw new ApiException( - "Missing the required parameter 'region' when calling listResourcePoolSnapshots(Async)"); - } - - // verify the required parameter 'resourcePoolId' is set - if (resourcePoolId == null) { - throw new ApiException( - "Missing the required parameter 'resourcePoolId' when calling listResourcePoolSnapshots(Async)"); + "Missing the required parameter 'region' when calling listResourcePoolSnapshots(Async)"); + } + + // verify the required parameter 'resourcePoolId' is set + if (resourcePoolId == null) { + throw new ApiException( + "Missing the required parameter 'resourcePoolId' when calling listResourcePoolSnapshots(Async)"); + } + + return listResourcePoolSnapshotsCall(projectId, region, resourcePoolId, _callback); + } + + /** + * List Resource Pool Snapshots Lists the Snapshots of a Resource Pool in a project. + * + * @param projectId (required) + * @param region (required) + * @param resourcePoolId (required) + * @return ListResourcePoolSnapshotsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public ListResourcePoolSnapshotsResponse listResourcePoolSnapshots( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId) + throws ApiException { + ApiResponse localVarResp = + listResourcePoolSnapshotsWithHttpInfo(projectId, region, resourcePoolId); + return localVarResp.getData(); + } + + /** + * List Resource Pool Snapshots Lists the Snapshots of a Resource Pool in a project. + * + * @param projectId (required) + * @param region (required) + * @param resourcePoolId (required) + * @return ApiResponse<ListResourcePoolSnapshotsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public ApiResponse listResourcePoolSnapshotsWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId) + throws ApiException { + okhttp3.Call localVarCall = + listResourcePoolSnapshotsValidateBeforeCall( + projectId, region, resourcePoolId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Resource Pool Snapshots (asynchronously) Lists the Snapshots of a Resource Pool in a + * project. + * + * @param projectId (required) + * @param region (required) + * @param resourcePoolId (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public okhttp3.Call listResourcePoolSnapshotsAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String resourcePoolId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listResourcePoolSnapshotsValidateBeforeCall( + projectId, region, resourcePoolId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listResourcePools + * + * @param projectId (required) + * @param region (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
400 Some fields of the request have failed the validation procedure. -
401 Please make sure the Authorization Header is set and uses correct credentials -
500 Please retry again later or contact support if the issue persists -
+ */ + public okhttp3.Call listResourcePoolsCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/regions/{region}/resourcePools" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json", "application/problem+json", "text/plain" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listResourcePoolsValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling listResourcePools(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listResourcePools(Async)"); } - return listResourcePoolSnapshotsCall(projectId, region, resourcePoolId, _callback); + return listResourcePoolsCall(projectId, region, _callback); } /** - * List Resource Pool Snapshots Lists the Snapshots of a Resource Pool in a project. + * List Resource Pools Lists Resource Pools in a project. * * @param projectId (required) * @param region (required) - * @param resourcePoolId (required) - * @return ListResourcePoolSnapshotsResponse + * @return ListResourcePoolsResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -3065,23 +3974,20 @@ private okhttp3.Call listResourcePoolSnapshotsValidateBeforeCall( * 500 Please retry again later or contact support if the issue persists - * */ - public ListResourcePoolSnapshotsResponse listResourcePoolSnapshots( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId) + public ListResourcePoolsResponse listResourcePools( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String region) throws ApiException { - ApiResponse localVarResp = - listResourcePoolSnapshotsWithHttpInfo(projectId, region, resourcePoolId); + ApiResponse localVarResp = + listResourcePoolsWithHttpInfo(projectId, region); return localVarResp.getData(); } /** - * List Resource Pool Snapshots Lists the Snapshots of a Resource Pool in a project. + * List Resource Pools Lists Resource Pools in a project. * * @param projectId (required) * @param region (required) - * @param resourcePoolId (required) - * @return ApiResponse<ListResourcePoolSnapshotsResponse> + * @return ApiResponse<ListResourcePoolsResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -3094,25 +4000,19 @@ public ListResourcePoolSnapshotsResponse listResourcePoolSnapshots( * 500 Please retry again later or contact support if the issue persists - * */ - public ApiResponse listResourcePoolSnapshotsWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId) + public ApiResponse listResourcePoolsWithHttpInfo( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String region) throws ApiException { - okhttp3.Call localVarCall = - listResourcePoolSnapshotsValidateBeforeCall( - projectId, region, resourcePoolId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = listResourcePoolsValidateBeforeCall(projectId, region, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Resource Pool Snapshots (asynchronously) Lists the Snapshots of a Resource Pool in a - * project. + * List Resource Pools (asynchronously) Lists Resource Pools in a project. * * @param projectId (required) * @param region (required) - * @param resourcePoolId (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body @@ -3127,26 +4027,23 @@ public ApiResponse listResourcePoolSnapshotsW * 500 Please retry again later or contact support if the issue persists - * */ - public okhttp3.Call listResourcePoolSnapshotsAsync( + public okhttp3.Call listResourcePoolsAsync( @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String region, - @javax.annotation.Nonnull String resourcePoolId, - final ApiCallback _callback) + final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = - listResourcePoolSnapshotsValidateBeforeCall( - projectId, region, resourcePoolId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + listResourcePoolsValidateBeforeCall(projectId, region, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for listResourcePools + * Build call for listSchedules * * @param projectId (required) - * @param region (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3155,15 +4052,11 @@ public okhttp3.Call listResourcePoolSnapshotsAsync( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public okhttp3.Call listResourcePoolsCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - final ApiCallback _callback) + public okhttp3.Call listSchedulesCall( + @javax.annotation.Nonnull String projectId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -3182,13 +4075,10 @@ public okhttp3.Call listResourcePoolsCall( // create path and map variables String localVarPath = - "/v1/projects/{projectId}/regions/{region}/resourcePools" + "/v1/projects/{projectId}/schedules" .replace( "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "region" + "}", - localVarApiClient.escapeString(region.toString())); + localVarApiClient.escapeString(projectId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -3196,9 +4086,7 @@ public okhttp3.Call listResourcePoolsCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { - "application/json", "application/problem+json", "text/plain" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); @@ -3227,32 +4115,23 @@ public okhttp3.Call listResourcePoolsCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call listResourcePoolsValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - final ApiCallback _callback) + private okhttp3.Call listSchedulesValidateBeforeCall( + @javax.annotation.Nonnull String projectId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'projectId' is set if (projectId == null) { throw new ApiException( - "Missing the required parameter 'projectId' when calling listResourcePools(Async)"); - } - - // verify the required parameter 'region' is set - if (region == null) { - throw new ApiException( - "Missing the required parameter 'region' when calling listResourcePools(Async)"); + "Missing the required parameter 'projectId' when calling listSchedules(Async)"); } - return listResourcePoolsCall(projectId, region, _callback); + return listSchedulesCall(projectId, _callback); } /** - * List Resource Pools Lists Resource Pools in a project. + * List Schedules * * @param projectId (required) - * @param region (required) - * @return ListResourcePoolsResponse + * @return ListSchedulesResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -3260,25 +4139,20 @@ private okhttp3.Call listResourcePoolsValidateBeforeCall( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public ListResourcePoolsResponse listResourcePools( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String region) + public ListSchedulesResponse listSchedules(@javax.annotation.Nonnull String projectId) throws ApiException { - ApiResponse localVarResp = - listResourcePoolsWithHttpInfo(projectId, region); + ApiResponse localVarResp = listSchedulesWithHttpInfo(projectId); return localVarResp.getData(); } /** - * List Resource Pools Lists Resource Pools in a project. + * List Schedules * * @param projectId (required) - * @param region (required) - * @return ApiResponse<ListResourcePoolsResponse> + * @return ApiResponse<ListSchedulesResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -3286,24 +4160,20 @@ public ListResourcePoolsResponse listResourcePools( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public ApiResponse listResourcePoolsWithHttpInfo( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String region) - throws ApiException { - okhttp3.Call localVarCall = listResourcePoolsValidateBeforeCall(projectId, region, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse listSchedulesWithHttpInfo( + @javax.annotation.Nonnull String projectId) throws ApiException { + okhttp3.Call localVarCall = listSchedulesValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Resource Pools (asynchronously) Lists Resource Pools in a project. + * (asynchronously) List Schedules * * @param projectId (required) - * @param region (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body @@ -3313,20 +4183,16 @@ public ApiResponse listResourcePoolsWithHttpInfo( * Response Details * Status Code Description Response Headers * 200 OK - - * 400 Some fields of the request have failed the validation procedure. - - * 401 Please make sure the Authorization Header is set and uses correct credentials - - * 500 Please retry again later or contact support if the issue persists - + * 0 Default error response - * */ - public okhttp3.Call listResourcePoolsAsync( + public okhttp3.Call listSchedulesAsync( @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String region, - final ApiCallback _callback) + final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - listResourcePoolsValidateBeforeCall(projectId, region, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = listSchedulesValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -3732,6 +4598,183 @@ public okhttp3.Call listSharesAsync( return localVarCall; } + /** + * Build call for listSnapshotPolicies + * + * @param projectId (required) + * @param immutable (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public okhttp3.Call listSnapshotPoliciesCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable Boolean immutable, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/snapshotPolicies" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (immutable != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("immutable", immutable)); + } + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listSnapshotPoliciesValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable Boolean immutable, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling listSnapshotPolicies(Async)"); + } + + return listSnapshotPoliciesCall(projectId, immutable, _callback); + } + + /** + * List Snapshot Policies + * + * @param projectId (required) + * @param immutable (optional) + * @return ListSnapshotPoliciesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public ListSnapshotPoliciesResponse listSnapshotPolicies( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable Boolean immutable) + throws ApiException { + ApiResponse localVarResp = + listSnapshotPoliciesWithHttpInfo(projectId, immutable); + return localVarResp.getData(); + } + + /** + * List Snapshot Policies + * + * @param projectId (required) + * @param immutable (optional) + * @return ApiResponse<ListSnapshotPoliciesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public ApiResponse listSnapshotPoliciesWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable Boolean immutable) + throws ApiException { + okhttp3.Call localVarCall = + listSnapshotPoliciesValidateBeforeCall(projectId, immutable, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) List Snapshot Policies + * + * @param projectId (required) + * @param immutable (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 OK -
0 Default error response -
+ */ + public okhttp3.Call listSnapshotPoliciesAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable Boolean immutable, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSnapshotPoliciesValidateBeforeCall(projectId, immutable, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** * Build call for updateResourcePool * diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateLockResponse.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateLockResponse.java new file mode 100644 index 0000000..4f2bb21 --- /dev/null +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateLockResponse.java @@ -0,0 +1,295 @@ +/* + * STACKIT File Storage (SFS) + * API used to create and manage NFS Shares. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package cloud.stackit.sdk.sfs.model; + +import cloud.stackit.sdk.sfs.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** CreateLockResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateLockResponse { + public static final String SERIALIZED_NAME_LOCK_ID = "lockId"; + + @SerializedName(SERIALIZED_NAME_LOCK_ID) + @javax.annotation.Nullable private String lockId; + + public CreateLockResponse() {} + + public CreateLockResponse lockId(@javax.annotation.Nullable String lockId) { + this.lockId = lockId; + return this; + } + + /** + * Get lockId + * + * @return lockId + */ + @javax.annotation.Nullable public String getLockId() { + return lockId; + } + + public void setLockId(@javax.annotation.Nullable String lockId) { + this.lockId = lockId; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateLockResponse instance itself + */ + public CreateLockResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateLockResponse createLockResponse = (CreateLockResponse) o; + return Objects.equals(this.lockId, createLockResponse.lockId) + && Objects.equals( + this.additionalProperties, createLockResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(lockId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateLockResponse {\n"); + sb.append(" lockId: ").append(toIndentedString(lockId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lockId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateLockResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateLockResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field(s) %s in CreateLockResponse is not found in the empty JSON string", + CreateLockResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("lockId") != null && !jsonObj.get("lockId").isJsonNull()) + && !jsonObj.get("lockId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `lockId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("lockId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateLockResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateLockResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateLockResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateLockResponse value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : + value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty( + entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateLockResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateLockResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` has unknown primitive type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateLockResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateLockResponse + * @throws IOException if the JSON string is invalid with respect to CreateLockResponse + */ + public static CreateLockResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateLockResponse.class); + } + + /** + * Convert an instance of CreateLockResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateResourcePoolPayload.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateResourcePoolPayload.java index 1411891..e4e7877 100644 --- a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateResourcePoolPayload.java +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateResourcePoolPayload.java @@ -71,6 +71,11 @@ public class CreateResourcePoolPayload { @javax.annotation.Nonnull private Integer sizeGigabytes; + public static final String SERIALIZED_NAME_SNAPSHOT_POLICY_ID = "snapshotPolicyId"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOT_POLICY_ID) + @javax.annotation.Nullable private String snapshotPolicyId; + public static final String SERIALIZED_NAME_SNAPSHOTS_ARE_VISIBLE = "snapshotsAreVisible"; @SerializedName(SERIALIZED_NAME_SNAPSHOTS_ARE_VISIBLE) @@ -214,6 +219,25 @@ public void setSizeGigabytes(@javax.annotation.Nonnull Integer sizeGigabytes) { this.sizeGigabytes = sizeGigabytes; } + public CreateResourcePoolPayload snapshotPolicyId( + @javax.annotation.Nullable String snapshotPolicyId) { + this.snapshotPolicyId = snapshotPolicyId; + return this; + } + + /** + * (optional) Id of the Snapshot Policy to use + * + * @return snapshotPolicyId + */ + @javax.annotation.Nullable public String getSnapshotPolicyId() { + return snapshotPolicyId; + } + + public void setSnapshotPolicyId(@javax.annotation.Nullable String snapshotPolicyId) { + this.snapshotPolicyId = snapshotPolicyId; + } + public CreateResourcePoolPayload snapshotsAreVisible( @javax.annotation.Nullable Boolean snapshotsAreVisible) { this.snapshotsAreVisible = snapshotsAreVisible; @@ -296,6 +320,7 @@ public boolean equals(Object o) { && Objects.equals(this.name, createResourcePoolPayload.name) && Objects.equals(this.performanceClass, createResourcePoolPayload.performanceClass) && Objects.equals(this.sizeGigabytes, createResourcePoolPayload.sizeGigabytes) + && Objects.equals(this.snapshotPolicyId, createResourcePoolPayload.snapshotPolicyId) && Objects.equals( this.snapshotsAreVisible, createResourcePoolPayload.snapshotsAreVisible) && Objects.equals( @@ -311,6 +336,7 @@ public int hashCode() { name, performanceClass, sizeGigabytes, + snapshotPolicyId, snapshotsAreVisible, additionalProperties); } @@ -325,6 +351,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" performanceClass: ").append(toIndentedString(performanceClass)).append("\n"); sb.append(" sizeGigabytes: ").append(toIndentedString(sizeGigabytes)).append("\n"); + sb.append(" snapshotPolicyId: ").append(toIndentedString(snapshotPolicyId)).append("\n"); sb.append(" snapshotsAreVisible: ") .append(toIndentedString(snapshotsAreVisible)) .append("\n"); @@ -360,6 +387,7 @@ private String toIndentedString(Object o) { "name", "performanceClass", "sizeGigabytes", + "snapshotPolicyId", "snapshotsAreVisible")); // a set of required properties/fields (JSON key names) @@ -435,6 +463,15 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti "Expected the field `performanceClass` to be a primitive type in the JSON string but got `%s`", jsonObj.get("performanceClass").toString())); } + if ((jsonObj.get("snapshotPolicyId") != null + && !jsonObj.get("snapshotPolicyId").isJsonNull()) + && !jsonObj.get("snapshotPolicyId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `snapshotPolicyId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("snapshotPolicyId").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateResourcePoolSnapshotPayload.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateResourcePoolSnapshotPayload.java index cb7b10f..4279bec 100644 --- a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateResourcePoolSnapshotPayload.java +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/CreateResourcePoolSnapshotPayload.java @@ -46,6 +46,11 @@ public class CreateResourcePoolSnapshotPayload { @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; + public static final String SERIALIZED_NAME_SNAPLOCK_RETENTION_HOURS = "snaplockRetentionHours"; + + @SerializedName(SERIALIZED_NAME_SNAPLOCK_RETENTION_HOURS) + @javax.annotation.Nullable private Integer snaplockRetentionHours; + public CreateResourcePoolSnapshotPayload() {} public CreateResourcePoolSnapshotPayload comment(@javax.annotation.Nullable String comment) { @@ -84,6 +89,26 @@ public void setName(@javax.annotation.Nullable String name) { this.name = name; } + public CreateResourcePoolSnapshotPayload snaplockRetentionHours( + @javax.annotation.Nullable Integer snaplockRetentionHours) { + this.snaplockRetentionHours = snaplockRetentionHours; + return this; + } + + /** + * (optional) Time in hours after which snaplock on the snapshot expires + * + * @return snaplockRetentionHours + */ + @javax.annotation.Nullable public Integer getSnaplockRetentionHours() { + return snaplockRetentionHours; + } + + public void setSnaplockRetentionHours( + @javax.annotation.Nullable Integer snaplockRetentionHours) { + this.snaplockRetentionHours = snaplockRetentionHours; + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -140,6 +165,9 @@ public boolean equals(Object o) { (CreateResourcePoolSnapshotPayload) o; return Objects.equals(this.comment, createResourcePoolSnapshotPayload.comment) && Objects.equals(this.name, createResourcePoolSnapshotPayload.name) + && Objects.equals( + this.snaplockRetentionHours, + createResourcePoolSnapshotPayload.snaplockRetentionHours) && Objects.equals( this.additionalProperties, createResourcePoolSnapshotPayload.additionalProperties); @@ -156,7 +184,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(comment, name, additionalProperties); + return Objects.hash(comment, name, snaplockRetentionHours, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -172,6 +200,9 @@ public String toString() { sb.append("class CreateResourcePoolSnapshotPayload {\n"); sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snaplockRetentionHours: ") + .append(toIndentedString(snaplockRetentionHours)) + .append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); @@ -195,7 +226,8 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("comment", "name")); + openapiFields = + new HashSet(Arrays.asList("comment", "name", "snaplockRetentionHours")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/GetScheduleResponse.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/GetScheduleResponse.java new file mode 100644 index 0000000..219c073 --- /dev/null +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/GetScheduleResponse.java @@ -0,0 +1,291 @@ +/* + * STACKIT File Storage (SFS) + * API used to create and manage NFS Shares. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package cloud.stackit.sdk.sfs.model; + +import cloud.stackit.sdk.sfs.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** GetScheduleResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class GetScheduleResponse { + public static final String SERIALIZED_NAME_SCHEDULE = "schedule"; + + @SerializedName(SERIALIZED_NAME_SCHEDULE) + @javax.annotation.Nullable private Schedule schedule; + + public GetScheduleResponse() {} + + public GetScheduleResponse schedule(@javax.annotation.Nullable Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Schedule + * + * @return schedule + */ + @javax.annotation.Nullable public Schedule getSchedule() { + return schedule; + } + + public void setSchedule(@javax.annotation.Nullable Schedule schedule) { + this.schedule = schedule; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the GetScheduleResponse instance itself + */ + public GetScheduleResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetScheduleResponse getScheduleResponse = (GetScheduleResponse) o; + return Objects.equals(this.schedule, getScheduleResponse.schedule) + && Objects.equals( + this.additionalProperties, getScheduleResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(schedule, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetScheduleResponse {\n"); + sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("schedule")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetScheduleResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetScheduleResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field(s) %s in GetScheduleResponse is not found in the empty JSON string", + GetScheduleResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `schedule` + if (jsonObj.get("schedule") != null && !jsonObj.get("schedule").isJsonNull()) { + Schedule.validateJsonElement(jsonObj.get("schedule")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetScheduleResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetScheduleResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetScheduleResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetScheduleResponse value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : + value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty( + entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public GetScheduleResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetScheduleResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` has unknown primitive type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetScheduleResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetScheduleResponse + * @throws IOException if the JSON string is invalid with respect to GetScheduleResponse + */ + public static GetScheduleResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetScheduleResponse.class); + } + + /** + * Convert an instance of GetScheduleResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/GetSnapshotPolicyResponse.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/GetSnapshotPolicyResponse.java new file mode 100644 index 0000000..c93ad5c --- /dev/null +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/GetSnapshotPolicyResponse.java @@ -0,0 +1,293 @@ +/* + * STACKIT File Storage (SFS) + * API used to create and manage NFS Shares. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package cloud.stackit.sdk.sfs.model; + +import cloud.stackit.sdk.sfs.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** GetSnapshotPolicyResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class GetSnapshotPolicyResponse { + public static final String SERIALIZED_NAME_SNAPSHOT_POLICY = "snapshotPolicy"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOT_POLICY) + @javax.annotation.Nullable private SnapshotPolicy snapshotPolicy; + + public GetSnapshotPolicyResponse() {} + + public GetSnapshotPolicyResponse snapshotPolicy( + @javax.annotation.Nullable SnapshotPolicy snapshotPolicy) { + this.snapshotPolicy = snapshotPolicy; + return this; + } + + /** + * Snapshot Policy + * + * @return snapshotPolicy + */ + @javax.annotation.Nullable public SnapshotPolicy getSnapshotPolicy() { + return snapshotPolicy; + } + + public void setSnapshotPolicy(@javax.annotation.Nullable SnapshotPolicy snapshotPolicy) { + this.snapshotPolicy = snapshotPolicy; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the GetSnapshotPolicyResponse instance itself + */ + public GetSnapshotPolicyResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSnapshotPolicyResponse getSnapshotPolicyResponse = (GetSnapshotPolicyResponse) o; + return Objects.equals(this.snapshotPolicy, getSnapshotPolicyResponse.snapshotPolicy) + && Objects.equals( + this.additionalProperties, getSnapshotPolicyResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(snapshotPolicy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSnapshotPolicyResponse {\n"); + sb.append(" snapshotPolicy: ").append(toIndentedString(snapshotPolicy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("snapshotPolicy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSnapshotPolicyResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSnapshotPolicyResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field(s) %s in GetSnapshotPolicyResponse is not found in the empty JSON string", + GetSnapshotPolicyResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `snapshotPolicy` + if (jsonObj.get("snapshotPolicy") != null && !jsonObj.get("snapshotPolicy").isJsonNull()) { + SnapshotPolicy.validateJsonElement(jsonObj.get("snapshotPolicy")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSnapshotPolicyResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSnapshotPolicyResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetSnapshotPolicyResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSnapshotPolicyResponse value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : + value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty( + entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public GetSnapshotPolicyResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetSnapshotPolicyResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` has unknown primitive type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of GetSnapshotPolicyResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSnapshotPolicyResponse + * @throws IOException if the JSON string is invalid with respect to GetSnapshotPolicyResponse + */ + public static GetSnapshotPolicyResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSnapshotPolicyResponse.class); + } + + /** + * Convert an instance of GetSnapshotPolicyResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ListSchedulesResponse.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ListSchedulesResponse.java new file mode 100644 index 0000000..eda1ee6 --- /dev/null +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ListSchedulesResponse.java @@ -0,0 +1,316 @@ +/* + * STACKIT File Storage (SFS) + * API used to create and manage NFS Shares. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package cloud.stackit.sdk.sfs.model; + +import cloud.stackit.sdk.sfs.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** ListSchedulesResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ListSchedulesResponse { + public static final String SERIALIZED_NAME_SCHEDULES = "schedules"; + + @SerializedName(SERIALIZED_NAME_SCHEDULES) + @javax.annotation.Nullable private List schedules = new ArrayList<>(); + + public ListSchedulesResponse() {} + + public ListSchedulesResponse schedules(@javax.annotation.Nullable List schedules) { + this.schedules = schedules; + return this; + } + + public ListSchedulesResponse addSchedulesItem(Schedule schedulesItem) { + if (this.schedules == null) { + this.schedules = new ArrayList<>(); + } + this.schedules.add(schedulesItem); + return this; + } + + /** + * List of Schedules + * + * @return schedules + */ + @javax.annotation.Nullable public List getSchedules() { + return schedules; + } + + public void setSchedules(@javax.annotation.Nullable List schedules) { + this.schedules = schedules; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ListSchedulesResponse instance itself + */ + public ListSchedulesResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListSchedulesResponse listSchedulesResponse = (ListSchedulesResponse) o; + return Objects.equals(this.schedules, listSchedulesResponse.schedules) + && Objects.equals( + this.additionalProperties, listSchedulesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(schedules, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListSchedulesResponse {\n"); + sb.append(" schedules: ").append(toIndentedString(schedules)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("schedules")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListSchedulesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListSchedulesResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field(s) %s in ListSchedulesResponse is not found in the empty JSON string", + ListSchedulesResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("schedules") != null && !jsonObj.get("schedules").isJsonNull()) { + JsonArray jsonArrayschedules = jsonObj.getAsJsonArray("schedules"); + if (jsonArrayschedules != null) { + // ensure the json data is an array + if (!jsonObj.get("schedules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `schedules` to be an array in the JSON string but got `%s`", + jsonObj.get("schedules").toString())); + } + + // validate the optional field `schedules` (array) + for (int i = 0; i < jsonArrayschedules.size(); i++) { + Schedule.validateJsonElement(jsonArrayschedules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListSchedulesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListSchedulesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ListSchedulesResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListSchedulesResponse value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : + value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty( + entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ListSchedulesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ListSchedulesResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` has unknown primitive type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListSchedulesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListSchedulesResponse + * @throws IOException if the JSON string is invalid with respect to ListSchedulesResponse + */ + public static ListSchedulesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListSchedulesResponse.class); + } + + /** + * Convert an instance of ListSchedulesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ListSnapshotPoliciesResponse.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ListSnapshotPoliciesResponse.java new file mode 100644 index 0000000..748c627 --- /dev/null +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ListSnapshotPoliciesResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT File Storage (SFS) + * API used to create and manage NFS Shares. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package cloud.stackit.sdk.sfs.model; + +import cloud.stackit.sdk.sfs.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** ListSnapshotPoliciesResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ListSnapshotPoliciesResponse { + public static final String SERIALIZED_NAME_SNAPSHOT_POLICIES = "snapshotPolicies"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOT_POLICIES) + @javax.annotation.Nullable private List snapshotPolicies = new ArrayList<>(); + + public ListSnapshotPoliciesResponse() {} + + public ListSnapshotPoliciesResponse snapshotPolicies( + @javax.annotation.Nullable List snapshotPolicies) { + this.snapshotPolicies = snapshotPolicies; + return this; + } + + public ListSnapshotPoliciesResponse addSnapshotPoliciesItem( + SnapshotPolicy snapshotPoliciesItem) { + if (this.snapshotPolicies == null) { + this.snapshotPolicies = new ArrayList<>(); + } + this.snapshotPolicies.add(snapshotPoliciesItem); + return this; + } + + /** + * List of Snapshot Policies + * + * @return snapshotPolicies + */ + @javax.annotation.Nullable public List getSnapshotPolicies() { + return snapshotPolicies; + } + + public void setSnapshotPolicies( + @javax.annotation.Nullable List snapshotPolicies) { + this.snapshotPolicies = snapshotPolicies; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ListSnapshotPoliciesResponse instance itself + */ + public ListSnapshotPoliciesResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListSnapshotPoliciesResponse listSnapshotPoliciesResponse = + (ListSnapshotPoliciesResponse) o; + return Objects.equals(this.snapshotPolicies, listSnapshotPoliciesResponse.snapshotPolicies) + && Objects.equals( + this.additionalProperties, + listSnapshotPoliciesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(snapshotPolicies, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListSnapshotPoliciesResponse {\n"); + sb.append(" snapshotPolicies: ").append(toIndentedString(snapshotPolicies)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("snapshotPolicies")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to + * ListSnapshotPoliciesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListSnapshotPoliciesResponse.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field(s) %s in ListSnapshotPoliciesResponse is not found in the empty JSON string", + ListSnapshotPoliciesResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("snapshotPolicies") != null + && !jsonObj.get("snapshotPolicies").isJsonNull()) { + JsonArray jsonArraysnapshotPolicies = jsonObj.getAsJsonArray("snapshotPolicies"); + if (jsonArraysnapshotPolicies != null) { + // ensure the json data is an array + if (!jsonObj.get("snapshotPolicies").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `snapshotPolicies` to be an array in the JSON string but got `%s`", + jsonObj.get("snapshotPolicies").toString())); + } + + // validate the optional field `snapshotPolicies` (array) + for (int i = 0; i < jsonArraysnapshotPolicies.size(); i++) { + SnapshotPolicy.validateJsonElement(jsonArraysnapshotPolicies.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListSnapshotPoliciesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListSnapshotPoliciesResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListSnapshotPoliciesResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListSnapshotPoliciesResponse value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : + value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty( + entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ListSnapshotPoliciesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ListSnapshotPoliciesResponse instance = + thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` has unknown primitive type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of ListSnapshotPoliciesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListSnapshotPoliciesResponse + * @throws IOException if the JSON string is invalid with respect to + * ListSnapshotPoliciesResponse + */ + public static ListSnapshotPoliciesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListSnapshotPoliciesResponse.class); + } + + /** + * Convert an instance of ListSnapshotPoliciesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePool.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePool.java index ede2814..2201eac 100644 --- a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePool.java +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePool.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; /** ResourcePool */ @javax.annotation.Generated( @@ -93,6 +94,11 @@ public class ResourcePool { @SerializedName(SERIALIZED_NAME_SIZE_REDUCIBLE_AT) @javax.annotation.Nullable private OffsetDateTime sizeReducibleAt; + public static final String SERIALIZED_NAME_SNAPSHOT_POLICY = "snapshotPolicy"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOT_POLICY) + @javax.annotation.Nullable private ResourcePoolSnapshotPolicy snapshotPolicy; + public static final String SERIALIZED_NAME_SNAPSHOTS_ARE_VISIBLE = "snapshotsAreVisible"; @SerializedName(SERIALIZED_NAME_SNAPSHOTS_ARE_VISIBLE) @@ -331,6 +337,26 @@ public void setSizeReducibleAt(@javax.annotation.Nullable OffsetDateTime sizeRed this.sizeReducibleAt = sizeReducibleAt; } + public ResourcePool snapshotPolicy( + @javax.annotation.Nullable ResourcePoolSnapshotPolicy snapshotPolicy) { + this.snapshotPolicy = snapshotPolicy; + return this; + } + + /** + * (optional) Snapshot Policy + * + * @return snapshotPolicy + */ + @javax.annotation.Nullable public ResourcePoolSnapshotPolicy getSnapshotPolicy() { + return snapshotPolicy; + } + + public void setSnapshotPolicy( + @javax.annotation.Nullable ResourcePoolSnapshotPolicy snapshotPolicy) { + this.snapshotPolicy = snapshotPolicy; + } + public ResourcePool snapshotsAreVisible( @javax.annotation.Nullable Boolean snapshotsAreVisible) { this.snapshotsAreVisible = snapshotsAreVisible; @@ -457,12 +483,22 @@ public boolean equals(Object o) { this.performanceClassDowngradableAt, resourcePool.performanceClassDowngradableAt) && Objects.equals(this.sizeReducibleAt, resourcePool.sizeReducibleAt) + && Objects.equals(this.snapshotPolicy, resourcePool.snapshotPolicy) && Objects.equals(this.snapshotsAreVisible, resourcePool.snapshotsAreVisible) && Objects.equals(this.space, resourcePool.space) && Objects.equals(this.state, resourcePool.state) && Objects.equals(this.additionalProperties, resourcePool.additionalProperties); } + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + @Override public int hashCode() { return Objects.hash( @@ -477,12 +513,20 @@ public int hashCode() { performanceClass, performanceClassDowngradableAt, sizeReducibleAt, + snapshotPolicy, snapshotsAreVisible, space, state, additionalProperties); } + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -500,6 +544,7 @@ public String toString() { .append(toIndentedString(performanceClassDowngradableAt)) .append("\n"); sb.append(" sizeReducibleAt: ").append(toIndentedString(sizeReducibleAt)).append("\n"); + sb.append(" snapshotPolicy: ").append(toIndentedString(snapshotPolicy)).append("\n"); sb.append(" snapshotsAreVisible: ") .append(toIndentedString(snapshotsAreVisible)) .append("\n"); @@ -542,6 +587,7 @@ private String toIndentedString(Object o) { "performanceClass", "performanceClassDowngradableAt", "sizeReducibleAt", + "snapshotPolicy", "snapshotsAreVisible", "space", "state")); @@ -616,6 +662,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti && !jsonObj.get("performanceClass").isJsonNull()) { ResourcePoolPerformanceClass.validateJsonElement(jsonObj.get("performanceClass")); } + // validate the optional field `snapshotPolicy` + if (jsonObj.get("snapshotPolicy") != null && !jsonObj.get("snapshotPolicy").isJsonNull()) { + ResourcePoolSnapshotPolicy.validateJsonElement(jsonObj.get("snapshotPolicy")); + } // validate the optional field `space` if (jsonObj.get("space") != null && !jsonObj.get("space").isJsonNull()) { ResourcePoolSpace.validateJsonElement(jsonObj.get("space")); diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSnapshot.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSnapshot.java index 82def10..2da1efd 100644 --- a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSnapshot.java +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSnapshot.java @@ -62,6 +62,11 @@ public class ResourcePoolSnapshot { @SerializedName(SERIALIZED_NAME_SIZE_GIGABYTES) @javax.annotation.Nullable private Integer sizeGigabytes; + public static final String SERIALIZED_NAME_SNAPLOCK_EXPIRY_TIME = "snaplockExpiryTime"; + + @SerializedName(SERIALIZED_NAME_SNAPLOCK_EXPIRY_TIME) + @javax.annotation.Nullable private OffsetDateTime snaplockExpiryTime; + public static final String SERIALIZED_NAME_SNAPSHOT_NAME = "snapshotName"; @SerializedName(SERIALIZED_NAME_SNAPSHOT_NAME) @@ -162,6 +167,26 @@ public void setSizeGigabytes(@javax.annotation.Nullable Integer sizeGigabytes) { this.sizeGigabytes = sizeGigabytes; } + public ResourcePoolSnapshot snaplockExpiryTime( + @javax.annotation.Nullable OffsetDateTime snaplockExpiryTime) { + this.snaplockExpiryTime = snaplockExpiryTime; + return this; + } + + /** + * Represents the snaplock expiry time if snaplock is enabled for the resource pool + * + * @return snaplockExpiryTime + */ + @javax.annotation.Nullable public OffsetDateTime getSnaplockExpiryTime() { + return snaplockExpiryTime; + } + + public void setSnaplockExpiryTime( + @javax.annotation.Nullable OffsetDateTime snaplockExpiryTime) { + this.snaplockExpiryTime = snaplockExpiryTime; + } + public ResourcePoolSnapshot snapshotName(@javax.annotation.Nullable String snapshotName) { this.snapshotName = snapshotName; return this; @@ -239,6 +264,7 @@ public boolean equals(Object o) { this.logicalSizeGigabytes, resourcePoolSnapshot.logicalSizeGigabytes) && Objects.equals(this.resourcePoolId, resourcePoolSnapshot.resourcePoolId) && Objects.equals(this.sizeGigabytes, resourcePoolSnapshot.sizeGigabytes) + && Objects.equals(this.snaplockExpiryTime, resourcePoolSnapshot.snaplockExpiryTime) && Objects.equals(this.snapshotName, resourcePoolSnapshot.snapshotName) && Objects.equals( this.additionalProperties, resourcePoolSnapshot.additionalProperties); @@ -261,6 +287,7 @@ public int hashCode() { logicalSizeGigabytes, resourcePoolId, sizeGigabytes, + snaplockExpiryTime, snapshotName, additionalProperties); } @@ -283,6 +310,9 @@ public String toString() { .append("\n"); sb.append(" resourcePoolId: ").append(toIndentedString(resourcePoolId)).append("\n"); sb.append(" sizeGigabytes: ").append(toIndentedString(sizeGigabytes)).append("\n"); + sb.append(" snaplockExpiryTime: ") + .append(toIndentedString(snaplockExpiryTime)) + .append("\n"); sb.append(" snapshotName: ").append(toIndentedString(snapshotName)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) @@ -315,6 +345,7 @@ private String toIndentedString(Object o) { "logicalSizeGigabytes", "resourcePoolId", "sizeGigabytes", + "snaplockExpiryTime", "snapshotName")); // a set of required properties/fields (JSON key names) diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSnapshotPolicy.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSnapshotPolicy.java new file mode 100644 index 0000000..ac54f47 --- /dev/null +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSnapshotPolicy.java @@ -0,0 +1,329 @@ +/* + * STACKIT File Storage (SFS) + * API used to create and manage NFS Shares. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package cloud.stackit.sdk.sfs.model; + +import cloud.stackit.sdk.sfs.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** ResourcePoolSnapshotPolicy */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ResourcePoolSnapshotPolicy { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public ResourcePoolSnapshotPolicy() {} + + public ResourcePoolSnapshotPolicy id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the Snapshot Policy + * + * @return id + */ + @javax.annotation.Nullable public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + public ResourcePoolSnapshotPolicy name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the Snapshot Policy + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ResourcePoolSnapshotPolicy instance itself + */ + public ResourcePoolSnapshotPolicy putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResourcePoolSnapshotPolicy resourcePoolSnapshotPolicy = (ResourcePoolSnapshotPolicy) o; + return Objects.equals(this.id, resourcePoolSnapshotPolicy.id) + && Objects.equals(this.name, resourcePoolSnapshotPolicy.name) + && Objects.equals( + this.additionalProperties, resourcePoolSnapshotPolicy.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResourcePoolSnapshotPolicy {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResourcePoolSnapshotPolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResourcePoolSnapshotPolicy.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field(s) %s in ResourcePoolSnapshotPolicy is not found in the empty JSON string", + ResourcePoolSnapshotPolicy.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResourcePoolSnapshotPolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResourcePoolSnapshotPolicy' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ResourcePoolSnapshotPolicy.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ResourcePoolSnapshotPolicy value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : + value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty( + entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ResourcePoolSnapshotPolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ResourcePoolSnapshotPolicy instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` has unknown primitive type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of ResourcePoolSnapshotPolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResourcePoolSnapshotPolicy + * @throws IOException if the JSON string is invalid with respect to ResourcePoolSnapshotPolicy + */ + public static ResourcePoolSnapshotPolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResourcePoolSnapshotPolicy.class); + } + + /** + * Convert an instance of ResourcePoolSnapshotPolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSpace.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSpace.java index d9a5e7d..400a2db 100644 --- a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSpace.java +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/ResourcePoolSpace.java @@ -46,6 +46,12 @@ public class ResourcePoolSpace { @SerializedName(SERIALIZED_NAME_SIZE_GIGABYTES) @javax.annotation.Nullable private Integer sizeGigabytes; + public static final String SERIALIZED_NAME_USED_BY_SNAPSHOTS_GIGABYTES = + "usedBySnapshotsGigabytes"; + + @SerializedName(SERIALIZED_NAME_USED_BY_SNAPSHOTS_GIGABYTES) + @javax.annotation.Nullable private Double usedBySnapshotsGigabytes; + public static final String SERIALIZED_NAME_USED_GIGABYTES = "usedGigabytes"; @SerializedName(SERIALIZED_NAME_USED_GIGABYTES) @@ -91,6 +97,26 @@ public void setSizeGigabytes(@javax.annotation.Nullable Integer sizeGigabytes) { this.sizeGigabytes = sizeGigabytes; } + public ResourcePoolSpace usedBySnapshotsGigabytes( + @javax.annotation.Nullable Double usedBySnapshotsGigabytes) { + this.usedBySnapshotsGigabytes = usedBySnapshotsGigabytes; + return this; + } + + /** + * Used space by snapshots (only available when retrieving a single Resource Pool by ID) + * + * @return usedBySnapshotsGigabytes + */ + @javax.annotation.Nullable public Double getUsedBySnapshotsGigabytes() { + return usedBySnapshotsGigabytes; + } + + public void setUsedBySnapshotsGigabytes( + @javax.annotation.Nullable Double usedBySnapshotsGigabytes) { + this.usedBySnapshotsGigabytes = usedBySnapshotsGigabytes; + } + public ResourcePoolSpace usedGigabytes(@javax.annotation.Nullable Double usedGigabytes) { this.usedGigabytes = usedGigabytes; return this; @@ -164,6 +190,8 @@ public boolean equals(Object o) { ResourcePoolSpace resourcePoolSpace = (ResourcePoolSpace) o; return Objects.equals(this.availableGigabytes, resourcePoolSpace.availableGigabytes) && Objects.equals(this.sizeGigabytes, resourcePoolSpace.sizeGigabytes) + && Objects.equals( + this.usedBySnapshotsGigabytes, resourcePoolSpace.usedBySnapshotsGigabytes) && Objects.equals(this.usedGigabytes, resourcePoolSpace.usedGigabytes) && Objects.equals( this.additionalProperties, resourcePoolSpace.additionalProperties); @@ -180,7 +208,12 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(availableGigabytes, sizeGigabytes, usedGigabytes, additionalProperties); + return Objects.hash( + availableGigabytes, + sizeGigabytes, + usedBySnapshotsGigabytes, + usedGigabytes, + additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -198,6 +231,9 @@ public String toString() { .append(toIndentedString(availableGigabytes)) .append("\n"); sb.append(" sizeGigabytes: ").append(toIndentedString(sizeGigabytes)).append("\n"); + sb.append(" usedBySnapshotsGigabytes: ") + .append(toIndentedString(usedBySnapshotsGigabytes)) + .append("\n"); sb.append(" usedGigabytes: ").append(toIndentedString(usedGigabytes)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) @@ -224,7 +260,11 @@ private String toIndentedString(Object o) { // a set of all properties/fields (JSON key names) openapiFields = new HashSet( - Arrays.asList("availableGigabytes", "sizeGigabytes", "usedGigabytes")); + Arrays.asList( + "availableGigabytes", + "sizeGigabytes", + "usedBySnapshotsGigabytes", + "usedGigabytes")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/Schedule.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/Schedule.java new file mode 100644 index 0000000..2978c2d --- /dev/null +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/Schedule.java @@ -0,0 +1,385 @@ +/* + * STACKIT File Storage (SFS) + * API used to create and manage NFS Shares. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package cloud.stackit.sdk.sfs.model; + +import cloud.stackit.sdk.sfs.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Schedule */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Schedule { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private String id; + + public static final String SERIALIZED_NAME_INTERVAL = "interval"; + + @SerializedName(SERIALIZED_NAME_INTERVAL) + @javax.annotation.Nullable private String interval; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public Schedule() {} + + public Schedule createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * created at timestamp + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public Schedule id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the Schedule + * + * @return id + */ + @javax.annotation.Nullable public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + public Schedule interval(@javax.annotation.Nullable String interval) { + this.interval = interval; + return this; + } + + /** + * Interval of the Schedule (follows the cron schedule expression in Unix-like systems) + * + * @return interval + */ + @javax.annotation.Nullable public String getInterval() { + return interval; + } + + public void setInterval(@javax.annotation.Nullable String interval) { + this.interval = interval; + } + + public Schedule name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the Schedule + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Schedule instance itself + */ + public Schedule putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Schedule schedule = (Schedule) o; + return Objects.equals(this.createdAt, schedule.createdAt) + && Objects.equals(this.id, schedule.id) + && Objects.equals(this.interval, schedule.interval) + && Objects.equals(this.name, schedule.name) + && Objects.equals(this.additionalProperties, schedule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, id, interval, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Schedule {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" interval: ").append(toIndentedString(interval)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("createdAt", "id", "interval", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Schedule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Schedule.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field(s) %s in Schedule is not found in the empty JSON string", + Schedule.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("interval") != null && !jsonObj.get("interval").isJsonNull()) + && !jsonObj.get("interval").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `interval` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("interval").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Schedule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Schedule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Schedule.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Schedule value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : + value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty( + entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Schedule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Schedule instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` has unknown primitive type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of Schedule given an JSON string + * + * @param jsonString JSON string + * @return An instance of Schedule + * @throws IOException if the JSON string is invalid with respect to Schedule + */ + public static Schedule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Schedule.class); + } + + /** + * Convert an instance of Schedule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/SnapshotPolicy.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/SnapshotPolicy.java new file mode 100644 index 0000000..3285505 --- /dev/null +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/SnapshotPolicy.java @@ -0,0 +1,468 @@ +/* + * STACKIT File Storage (SFS) + * API used to create and manage NFS Shares. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package cloud.stackit.sdk.sfs.model; + +import cloud.stackit.sdk.sfs.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** SnapshotPolicy */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SnapshotPolicy { + public static final String SERIALIZED_NAME_COMMENT = "comment"; + + @SerializedName(SERIALIZED_NAME_COMMENT) + @javax.annotation.Nullable private String comment; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + + @SerializedName(SERIALIZED_NAME_ENABLED) + @javax.annotation.Nullable private Boolean enabled; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SCHEDULES = "schedules"; + + @SerializedName(SERIALIZED_NAME_SCHEDULES) + @javax.annotation.Nullable private List schedules = new ArrayList<>(); + + public SnapshotPolicy() {} + + public SnapshotPolicy comment(@javax.annotation.Nullable String comment) { + this.comment = comment; + return this; + } + + /** + * Comment of the Snapshot Policy + * + * @return comment + */ + @javax.annotation.Nullable public String getComment() { + return comment; + } + + public void setComment(@javax.annotation.Nullable String comment) { + this.comment = comment; + } + + public SnapshotPolicy createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * created at timestamp + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public SnapshotPolicy enabled(@javax.annotation.Nullable Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Wether the Snapshot Policy is enabled + * + * @return enabled + */ + @javax.annotation.Nullable public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(@javax.annotation.Nullable Boolean enabled) { + this.enabled = enabled; + } + + public SnapshotPolicy id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the Snapshot Policy + * + * @return id + */ + @javax.annotation.Nullable public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + public SnapshotPolicy name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the Snapshot Policy + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public SnapshotPolicy schedules( + @javax.annotation.Nullable List schedules) { + this.schedules = schedules; + return this; + } + + public SnapshotPolicy addSchedulesItem(SnapshotPolicySchedule schedulesItem) { + if (this.schedules == null) { + this.schedules = new ArrayList<>(); + } + this.schedules.add(schedulesItem); + return this; + } + + /** + * associated schedules + * + * @return schedules + */ + @javax.annotation.Nullable public List getSchedules() { + return schedules; + } + + public void setSchedules(@javax.annotation.Nullable List schedules) { + this.schedules = schedules; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapshotPolicy instance itself + */ + public SnapshotPolicy putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnapshotPolicy snapshotPolicy = (SnapshotPolicy) o; + return Objects.equals(this.comment, snapshotPolicy.comment) + && Objects.equals(this.createdAt, snapshotPolicy.createdAt) + && Objects.equals(this.enabled, snapshotPolicy.enabled) + && Objects.equals(this.id, snapshotPolicy.id) + && Objects.equals(this.name, snapshotPolicy.name) + && Objects.equals(this.schedules, snapshotPolicy.schedules) + && Objects.equals(this.additionalProperties, snapshotPolicy.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(comment, createdAt, enabled, id, name, schedules, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapshotPolicy {\n"); + sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" schedules: ").append(toIndentedString(schedules)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = + new HashSet( + Arrays.asList( + "comment", "createdAt", "enabled", "id", "name", "schedules")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SnapshotPolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SnapshotPolicy.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field(s) %s in SnapshotPolicy is not found in the empty JSON string", + SnapshotPolicy.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("comment") != null && !jsonObj.get("comment").isJsonNull()) + && !jsonObj.get("comment").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `comment` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("comment").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if (jsonObj.get("schedules") != null && !jsonObj.get("schedules").isJsonNull()) { + JsonArray jsonArrayschedules = jsonObj.getAsJsonArray("schedules"); + if (jsonArrayschedules != null) { + // ensure the json data is an array + if (!jsonObj.get("schedules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `schedules` to be an array in the JSON string but got `%s`", + jsonObj.get("schedules").toString())); + } + + // validate the optional field `schedules` (array) + for (int i = 0; i < jsonArrayschedules.size(); i++) { + SnapshotPolicySchedule.validateJsonElement(jsonArrayschedules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapshotPolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapshotPolicy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SnapshotPolicy.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapshotPolicy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : + value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty( + entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SnapshotPolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SnapshotPolicy instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` has unknown primitive type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of SnapshotPolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapshotPolicy + * @throws IOException if the JSON string is invalid with respect to SnapshotPolicy + */ + public static SnapshotPolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapshotPolicy.class); + } + + /** + * Convert an instance of SnapshotPolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/SnapshotPolicySchedule.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/SnapshotPolicySchedule.java new file mode 100644 index 0000000..415caaf --- /dev/null +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/SnapshotPolicySchedule.java @@ -0,0 +1,389 @@ +/* + * STACKIT File Storage (SFS) + * API used to create and manage NFS Shares. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package cloud.stackit.sdk.sfs.model; + +import cloud.stackit.sdk.sfs.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** SnapshotPolicySchedule */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SnapshotPolicySchedule { + public static final String SERIALIZED_NAME_COUNT = "count"; + + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable private Integer count; + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nullable private String prefix; + + public static final String SERIALIZED_NAME_RETENTION_PERIOD = "retentionPeriod"; + + @SerializedName(SERIALIZED_NAME_RETENTION_PERIOD) + @javax.annotation.Nullable private String retentionPeriod; + + public static final String SERIALIZED_NAME_SCHEDULE_ID = "scheduleId"; + + @SerializedName(SERIALIZED_NAME_SCHEDULE_ID) + @javax.annotation.Nullable private String scheduleId; + + public SnapshotPolicySchedule() {} + + public SnapshotPolicySchedule count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * + * @return count + */ + @javax.annotation.Nullable public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + public SnapshotPolicySchedule prefix(@javax.annotation.Nullable String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Get prefix + * + * @return prefix + */ + @javax.annotation.Nullable public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nullable String prefix) { + this.prefix = prefix; + } + + public SnapshotPolicySchedule retentionPeriod( + @javax.annotation.Nullable String retentionPeriod) { + this.retentionPeriod = retentionPeriod; + return this; + } + + /** + * Get retentionPeriod + * + * @return retentionPeriod + */ + @javax.annotation.Nullable public String getRetentionPeriod() { + return retentionPeriod; + } + + public void setRetentionPeriod(@javax.annotation.Nullable String retentionPeriod) { + this.retentionPeriod = retentionPeriod; + } + + public SnapshotPolicySchedule scheduleId(@javax.annotation.Nullable String scheduleId) { + this.scheduleId = scheduleId; + return this; + } + + /** + * Get scheduleId + * + * @return scheduleId + */ + @javax.annotation.Nullable public String getScheduleId() { + return scheduleId; + } + + public void setScheduleId(@javax.annotation.Nullable String scheduleId) { + this.scheduleId = scheduleId; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapshotPolicySchedule instance itself + */ + public SnapshotPolicySchedule putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnapshotPolicySchedule snapshotPolicySchedule = (SnapshotPolicySchedule) o; + return Objects.equals(this.count, snapshotPolicySchedule.count) + && Objects.equals(this.prefix, snapshotPolicySchedule.prefix) + && Objects.equals(this.retentionPeriod, snapshotPolicySchedule.retentionPeriod) + && Objects.equals(this.scheduleId, snapshotPolicySchedule.scheduleId) + && Objects.equals( + this.additionalProperties, snapshotPolicySchedule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(count, prefix, retentionPeriod, scheduleId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapshotPolicySchedule {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" retentionPeriod: ").append(toIndentedString(retentionPeriod)).append("\n"); + sb.append(" scheduleId: ").append(toIndentedString(scheduleId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = + new HashSet( + Arrays.asList("count", "prefix", "retentionPeriod", "scheduleId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SnapshotPolicySchedule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SnapshotPolicySchedule.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field(s) %s in SnapshotPolicySchedule is not found in the empty JSON string", + SnapshotPolicySchedule.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("prefix") != null && !jsonObj.get("prefix").isJsonNull()) + && !jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + if ((jsonObj.get("retentionPeriod") != null && !jsonObj.get("retentionPeriod").isJsonNull()) + && !jsonObj.get("retentionPeriod").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `retentionPeriod` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("retentionPeriod").toString())); + } + if ((jsonObj.get("scheduleId") != null && !jsonObj.get("scheduleId").isJsonNull()) + && !jsonObj.get("scheduleId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `scheduleId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("scheduleId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapshotPolicySchedule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapshotPolicySchedule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SnapshotPolicySchedule.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapshotPolicySchedule value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : + value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty( + entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SnapshotPolicySchedule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SnapshotPolicySchedule instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty( + entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty( + entry.getKey(), + entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` has unknown primitive type. Value: %s", + entry.getKey(), + entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty( + entry.getKey(), + gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + }.nullSafe(); + } + } + + /** + * Create an instance of SnapshotPolicySchedule given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapshotPolicySchedule + * @throws IOException if the JSON string is invalid with respect to SnapshotPolicySchedule + */ + public static SnapshotPolicySchedule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapshotPolicySchedule.class); + } + + /** + * Convert an instance of SnapshotPolicySchedule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/UpdateResourcePoolPayload.java b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/UpdateResourcePoolPayload.java index f3f1921..3367471 100644 --- a/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/UpdateResourcePoolPayload.java +++ b/services/sfs/src/main/java/cloud/stackit/sdk/sfs/model/UpdateResourcePoolPayload.java @@ -57,6 +57,11 @@ public class UpdateResourcePoolPayload { @SerializedName(SERIALIZED_NAME_SIZE_GIGABYTES) @javax.annotation.Nullable private Integer sizeGigabytes; + public static final String SERIALIZED_NAME_SNAPSHOT_POLICY_ID = "snapshotPolicyId"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOT_POLICY_ID) + @javax.annotation.Nullable private String snapshotPolicyId; + public static final String SERIALIZED_NAME_SNAPSHOTS_ARE_VISIBLE = "snapshotsAreVisible"; @SerializedName(SERIALIZED_NAME_SNAPSHOTS_ARE_VISIBLE) @@ -158,6 +163,26 @@ public void setSizeGigabytes(@javax.annotation.Nullable Integer sizeGigabytes) { this.sizeGigabytes = sizeGigabytes; } + public UpdateResourcePoolPayload snapshotPolicyId( + @javax.annotation.Nullable String snapshotPolicyId) { + this.snapshotPolicyId = snapshotPolicyId; + return this; + } + + /** + * (optional) Id of the Snapshot Policy to use If not set, the Snapshot Policy is not updated If + * set to an empty string, the Snapshot Policy is removed + * + * @return snapshotPolicyId + */ + @javax.annotation.Nullable public String getSnapshotPolicyId() { + return snapshotPolicyId; + } + + public void setSnapshotPolicyId(@javax.annotation.Nullable String snapshotPolicyId) { + this.snapshotPolicyId = snapshotPolicyId; + } + public UpdateResourcePoolPayload snapshotsAreVisible( @javax.annotation.Nullable Boolean snapshotsAreVisible) { this.snapshotsAreVisible = snapshotsAreVisible; @@ -238,6 +263,7 @@ public boolean equals(Object o) { && Objects.equals(this.labels, updateResourcePoolPayload.labels) && Objects.equals(this.performanceClass, updateResourcePoolPayload.performanceClass) && Objects.equals(this.sizeGigabytes, updateResourcePoolPayload.sizeGigabytes) + && Objects.equals(this.snapshotPolicyId, updateResourcePoolPayload.snapshotPolicyId) && Objects.equals( this.snapshotsAreVisible, updateResourcePoolPayload.snapshotsAreVisible) && Objects.equals( @@ -260,6 +286,7 @@ public int hashCode() { labels, performanceClass, sizeGigabytes, + snapshotPolicyId, snapshotsAreVisible, additionalProperties); } @@ -279,6 +306,7 @@ public String toString() { sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); sb.append(" performanceClass: ").append(toIndentedString(performanceClass)).append("\n"); sb.append(" sizeGigabytes: ").append(toIndentedString(sizeGigabytes)).append("\n"); + sb.append(" snapshotPolicyId: ").append(toIndentedString(snapshotPolicyId)).append("\n"); sb.append(" snapshotsAreVisible: ") .append(toIndentedString(snapshotsAreVisible)) .append("\n"); @@ -312,6 +340,7 @@ private String toIndentedString(Object o) { "labels", "performanceClass", "sizeGigabytes", + "snapshotPolicyId", "snapshotsAreVisible")); // a set of required properties/fields (JSON key names) @@ -355,6 +384,15 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti "Expected the field `performanceClass` to be a primitive type in the JSON string but got `%s`", jsonObj.get("performanceClass").toString())); } + if ((jsonObj.get("snapshotPolicyId") != null + && !jsonObj.get("snapshotPolicyId").isJsonNull()) + && !jsonObj.get("snapshotPolicyId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `snapshotPolicyId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("snapshotPolicyId").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory {