-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #465 from SpectraLogic/4_1_x_API
Updating main branch from 4.0 to 4.1 API generation
- Loading branch information
Showing
28 changed files
with
561 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
ds3-autogen-c/src/test/resources/input/HeadObjectRequest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Data> | ||
<Contract> | ||
<RequestHandlers> | ||
<RequestHandler Classification="amazons3" Name="com.spectralogic.s3.server.handler.reqhandler.amazons3.HeadObjectRequestHandler"> | ||
<Request BucketRequirement="REQUIRED" HttpVerb="HEAD" IncludeIdInPath="false" ObjectRequirement="REQUIRED"> | ||
<OptionalQueryParams/> | ||
<RequiredQueryParams/> | ||
</Request> | ||
<ResponseCodes> | ||
<ResponseCode> | ||
<Code>200</Code> | ||
<ResponseTypes> | ||
<ResponseType Type="null"/> | ||
</ResponseTypes> | ||
</ResponseCode> | ||
<ResponseCode> | ||
<Code>404</Code> | ||
<ResponseTypes> | ||
<ResponseType Type="com.spectralogic.s3.server.domain.HttpErrorResultApiBean"/> | ||
</ResponseTypes> | ||
</ResponseCode> | ||
</ResponseCodes> | ||
<Version>1.CF182CD57551902A475553F26582BC78</Version> | ||
</RequestHandler> | ||
</RequestHandlers> | ||
</Contract> | ||
</Data> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
.../kotlin/com/spectralogic/ds3autogen/go/generators/response/HeadObjectResponseGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* ****************************************************************************** | ||
* Copyright 2014-2018 Spectra Logic Corporation. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use | ||
* this file except in compliance with the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. | ||
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* **************************************************************************** | ||
*/ | ||
|
||
package com.spectralogic.ds3autogen.go.generators.response | ||
|
||
import com.google.common.collect.ImmutableList | ||
import com.spectralogic.ds3autogen.api.models.apispec.Ds3ResponseCode | ||
import com.spectralogic.ds3autogen.go.models.response.ResponseCode | ||
import com.spectralogic.ds3autogen.go.utils.goIndent | ||
|
||
class HeadObjectResponseGenerator : BaseResponseGenerator() { | ||
|
||
override fun toResponsePayloadStruct(expectedResponseCodes: ImmutableList<Ds3ResponseCode>?): String { | ||
return "BlobChecksumType ChecksumType\n" + | ||
goIndent(1) + "BlobChecksums map[int64]string" | ||
} | ||
|
||
/** | ||
* Converts a Ds3ResponseCode into a ResponseCode model which contains the Go | ||
* code for parsing the specified response. | ||
*/ | ||
override fun toResponseCode(ds3ResponseCode: Ds3ResponseCode, responseName: String): ResponseCode { | ||
if (ds3ResponseCode.code == 200) { | ||
val parsingCode = "checksumType, err := getBlobChecksumType(webResponse.Header())\n" + | ||
goIndent(2) + "if err != nil {\n" + | ||
goIndent(3) + "return nil, err\n" + | ||
goIndent(2) + "}\n" + | ||
goIndent(2) + "checksumMap, err := getBlobChecksumMap(webResponse.Header())\n" + | ||
goIndent(2) + "if err != nil {\n" + | ||
goIndent(3) + "return nil, err\n" + | ||
goIndent(2) + "}\n" + | ||
goIndent(2) + "return &$responseName{BlobChecksumType: checksumType, BlobChecksums: checksumMap, Headers: webResponse.Header()}, nil" | ||
return ResponseCode(ds3ResponseCode.code, parsingCode) | ||
} | ||
return toStandardResponseCode(ds3ResponseCode, responseName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.