Skip to content

Commit 4c94ea6

Browse files
committed
generate base files based on swagger docs
1 parent 0d3f679 commit 4c94ea6

File tree

6 files changed

+684
-1
lines changed

6 files changed

+684
-1
lines changed

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
import com.azure.storage.blob.implementation.models.ContainersSetAccessPolicyHeaders;
4747
import com.azure.storage.blob.implementation.models.ContainersSetMetadataHeaders;
4848
import com.azure.storage.blob.implementation.models.ContainersSubmitBatchHeaders;
49+
import com.azure.storage.blob.implementation.models.CreateSessionConfiguration;
50+
import com.azure.storage.blob.implementation.models.CreateSessionResponse;
4951
import com.azure.storage.blob.implementation.models.FilterBlobSegment;
5052
import com.azure.storage.blob.implementation.models.FilterBlobsIncludeItem;
5153
import com.azure.storage.blob.implementation.models.ListBlobsFlatSegmentResponse;
@@ -938,6 +940,24 @@ Response<Void> getAccountInfoNoCustomHeadersSync(@HostParam("url") String url,
938940
@QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout,
939941
@HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId,
940942
@HeaderParam("Accept") String accept, Context context);
943+
944+
@Post("/{containerName}")
945+
@ExpectedResponses({ 201 })
946+
@UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class)
947+
Mono<Response<CreateSessionResponse>> createSession(@HostParam("url") String url,
948+
@PathParam("containerName") String containerName, @QueryParam("restype") String restype,
949+
@QueryParam("comp") String comp,
950+
@BodyParam("application/xml") CreateSessionConfiguration createSessionConfiguration,
951+
@HeaderParam("Accept") String accept, Context context);
952+
953+
@Post("/{containerName}")
954+
@ExpectedResponses({ 201 })
955+
@UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class)
956+
Response<CreateSessionResponse> createSessionSync(@HostParam("url") String url,
957+
@PathParam("containerName") String containerName, @QueryParam("restype") String restype,
958+
@QueryParam("comp") String comp,
959+
@BodyParam("application/xml") CreateSessionConfiguration createSessionConfiguration,
960+
@HeaderParam("Accept") String accept, Context context);
941961
}
942962

943963
/**
@@ -6707,4 +6727,127 @@ public Response<Void> getAccountInfoNoCustomHeadersWithResponse(String container
67076727
throw ModelHelper.mapToBlobStorageException(internalException);
67086728
}
67096729
}
6730+
6731+
/**
6732+
* The Create Session operation enables users to create a session scoped to a container.
6733+
*
6734+
* @param containerName The container name.
6735+
* @param createSessionConfiguration The createSessionConfiguration parameter.
6736+
* @throws IllegalArgumentException thrown if parameters fail the validation.
6737+
* @throws BlobStorageExceptionInternal thrown if the request is rejected by server.
6738+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
6739+
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
6740+
*/
6741+
@ServiceMethod(returns = ReturnType.SINGLE)
6742+
public Mono<Response<CreateSessionResponse>> createSessionWithResponseAsync(String containerName,
6743+
CreateSessionConfiguration createSessionConfiguration) {
6744+
return FluxUtil
6745+
.withContext(context -> createSessionWithResponseAsync(containerName, createSessionConfiguration, context))
6746+
.onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException);
6747+
}
6748+
6749+
/**
6750+
* The Create Session operation enables users to create a session scoped to a container.
6751+
*
6752+
* @param containerName The container name.
6753+
* @param createSessionConfiguration The createSessionConfiguration parameter.
6754+
* @param context The context to associate with this operation.
6755+
* @throws IllegalArgumentException thrown if parameters fail the validation.
6756+
* @throws BlobStorageExceptionInternal thrown if the request is rejected by server.
6757+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
6758+
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
6759+
*/
6760+
@ServiceMethod(returns = ReturnType.SINGLE)
6761+
public Mono<Response<CreateSessionResponse>> createSessionWithResponseAsync(String containerName,
6762+
CreateSessionConfiguration createSessionConfiguration, Context context) {
6763+
final String restype = "container";
6764+
final String comp = "session";
6765+
final String accept = "application/xml";
6766+
return service
6767+
.createSession(this.client.getUrl(), containerName, restype, comp, createSessionConfiguration, accept,
6768+
context)
6769+
.onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException);
6770+
}
6771+
6772+
/**
6773+
* The Create Session operation enables users to create a session scoped to a container.
6774+
*
6775+
* @param containerName The container name.
6776+
* @param createSessionConfiguration The createSessionConfiguration parameter.
6777+
* @throws IllegalArgumentException thrown if parameters fail the validation.
6778+
* @throws BlobStorageExceptionInternal thrown if the request is rejected by server.
6779+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
6780+
* @return the response body on successful completion of {@link Mono}.
6781+
*/
6782+
@ServiceMethod(returns = ReturnType.SINGLE)
6783+
public Mono<CreateSessionResponse> createSessionAsync(String containerName,
6784+
CreateSessionConfiguration createSessionConfiguration) {
6785+
return createSessionWithResponseAsync(containerName, createSessionConfiguration)
6786+
.onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException)
6787+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
6788+
}
6789+
6790+
/**
6791+
* The Create Session operation enables users to create a session scoped to a container.
6792+
*
6793+
* @param containerName The container name.
6794+
* @param createSessionConfiguration The createSessionConfiguration parameter.
6795+
* @param context The context to associate with this operation.
6796+
* @throws IllegalArgumentException thrown if parameters fail the validation.
6797+
* @throws BlobStorageExceptionInternal thrown if the request is rejected by server.
6798+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
6799+
* @return the response body on successful completion of {@link Mono}.
6800+
*/
6801+
@ServiceMethod(returns = ReturnType.SINGLE)
6802+
public Mono<CreateSessionResponse> createSessionAsync(String containerName,
6803+
CreateSessionConfiguration createSessionConfiguration, Context context) {
6804+
return createSessionWithResponseAsync(containerName, createSessionConfiguration, context)
6805+
.onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException)
6806+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
6807+
}
6808+
6809+
/**
6810+
* The Create Session operation enables users to create a session scoped to a container.
6811+
*
6812+
* @param containerName The container name.
6813+
* @param createSessionConfiguration The createSessionConfiguration parameter.
6814+
* @param context The context to associate with this operation.
6815+
* @throws IllegalArgumentException thrown if parameters fail the validation.
6816+
* @throws BlobStorageExceptionInternal thrown if the request is rejected by server.
6817+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
6818+
* @return the response body along with {@link Response}.
6819+
*/
6820+
@ServiceMethod(returns = ReturnType.SINGLE)
6821+
public Response<CreateSessionResponse> createSessionWithResponse(String containerName,
6822+
CreateSessionConfiguration createSessionConfiguration, Context context) {
6823+
try {
6824+
final String restype = "container";
6825+
final String comp = "session";
6826+
final String accept = "application/xml";
6827+
return service.createSessionSync(this.client.getUrl(), containerName, restype, comp,
6828+
createSessionConfiguration, accept, context);
6829+
} catch (BlobStorageExceptionInternal internalException) {
6830+
throw ModelHelper.mapToBlobStorageException(internalException);
6831+
}
6832+
}
6833+
6834+
/**
6835+
* The Create Session operation enables users to create a session scoped to a container.
6836+
*
6837+
* @param containerName The container name.
6838+
* @param createSessionConfiguration The createSessionConfiguration parameter.
6839+
* @throws IllegalArgumentException thrown if parameters fail the validation.
6840+
* @throws BlobStorageExceptionInternal thrown if the request is rejected by server.
6841+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
6842+
* @return the response.
6843+
*/
6844+
@ServiceMethod(returns = ReturnType.SINGLE)
6845+
public CreateSessionResponse createSession(String containerName,
6846+
CreateSessionConfiguration createSessionConfiguration) {
6847+
try {
6848+
return createSessionWithResponse(containerName, createSessionConfiguration, Context.NONE).getValue();
6849+
} catch (BlobStorageExceptionInternal internalException) {
6850+
throw ModelHelper.mapToBlobStorageException(internalException);
6851+
}
6852+
}
67106853
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
5+
package com.azure.storage.blob.implementation.models;
6+
7+
import com.azure.core.annotation.Generated;
8+
import com.azure.core.util.ExpandableStringEnum;
9+
import java.util.Collection;
10+
11+
/**
12+
* The type of authentication required to create the session. The only type currently supported is HMAC.
13+
*/
14+
public final class AuthenticationType extends ExpandableStringEnum<AuthenticationType> {
15+
/**
16+
* Static value HMAC for AuthenticationType.
17+
*/
18+
@Generated
19+
public static final AuthenticationType HMAC = fromString("HMAC");
20+
21+
/**
22+
* Creates a new instance of AuthenticationType value.
23+
*
24+
* @deprecated Use the {@link #fromString(String)} factory method.
25+
*/
26+
@Generated
27+
@Deprecated
28+
public AuthenticationType() {
29+
}
30+
31+
/**
32+
* Creates or finds a AuthenticationType from its string representation.
33+
*
34+
* @param name a name to look for.
35+
* @return the corresponding AuthenticationType.
36+
*/
37+
@Generated
38+
public static AuthenticationType fromString(String name) {
39+
return fromString(name, AuthenticationType.class);
40+
}
41+
42+
/**
43+
* Gets known AuthenticationType values.
44+
*
45+
* @return known AuthenticationType values.
46+
*/
47+
@Generated
48+
public static Collection<AuthenticationType> values() {
49+
return values(AuthenticationType.class);
50+
}
51+
}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
5+
package com.azure.storage.blob.implementation.models;
6+
7+
import com.azure.core.annotation.Fluent;
8+
import com.azure.core.annotation.Generated;
9+
import com.azure.xml.XmlReader;
10+
import com.azure.xml.XmlSerializable;
11+
import com.azure.xml.XmlToken;
12+
import com.azure.xml.XmlWriter;
13+
import javax.xml.namespace.QName;
14+
import javax.xml.stream.XMLStreamException;
15+
16+
/**
17+
* The CreateSessionConfiguration model.
18+
*/
19+
@Fluent
20+
public final class CreateSessionConfiguration implements XmlSerializable<CreateSessionConfiguration> {
21+
/*
22+
* The type of authentication required to create the session. The only type currently supported is HMAC.
23+
*/
24+
@Generated
25+
private AuthenticationType authenticationType;
26+
27+
/**
28+
* Creates an instance of CreateSessionConfiguration class.
29+
*/
30+
@Generated
31+
public CreateSessionConfiguration() {
32+
}
33+
34+
/**
35+
* Get the authenticationType property: The type of authentication required to create the session. The only type
36+
* currently supported is HMAC.
37+
*
38+
* @return the authenticationType value.
39+
*/
40+
@Generated
41+
public AuthenticationType getAuthenticationType() {
42+
return this.authenticationType;
43+
}
44+
45+
/**
46+
* Set the authenticationType property: The type of authentication required to create the session. The only type
47+
* currently supported is HMAC.
48+
*
49+
* @param authenticationType the authenticationType value to set.
50+
* @return the CreateSessionConfiguration object itself.
51+
*/
52+
@Generated
53+
public CreateSessionConfiguration setAuthenticationType(AuthenticationType authenticationType) {
54+
this.authenticationType = authenticationType;
55+
return this;
56+
}
57+
58+
@Generated
59+
@Override
60+
public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException {
61+
return toXml(xmlWriter, null);
62+
}
63+
64+
@Generated
65+
@Override
66+
public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException {
67+
rootElementName
68+
= rootElementName == null || rootElementName.isEmpty() ? "CreateSessionRequest" : rootElementName;
69+
xmlWriter.writeStartElement(rootElementName);
70+
xmlWriter.writeStringElement("AuthenticationType",
71+
this.authenticationType == null ? null : this.authenticationType.toString());
72+
return xmlWriter.writeEndElement();
73+
}
74+
75+
/**
76+
* Reads an instance of CreateSessionConfiguration from the XmlReader.
77+
*
78+
* @param xmlReader The XmlReader being read.
79+
* @return An instance of CreateSessionConfiguration if the XmlReader was pointing to an instance of it, or null if
80+
* it was pointing to XML null.
81+
* @throws XMLStreamException If an error occurs while reading the CreateSessionConfiguration.
82+
*/
83+
@Generated
84+
public static CreateSessionConfiguration fromXml(XmlReader xmlReader) throws XMLStreamException {
85+
return fromXml(xmlReader, null);
86+
}
87+
88+
/**
89+
* Reads an instance of CreateSessionConfiguration from the XmlReader.
90+
*
91+
* @param xmlReader The XmlReader being read.
92+
* @param rootElementName Optional root element name to override the default defined by the model. Used to support
93+
* cases where the model can deserialize from different root element names.
94+
* @return An instance of CreateSessionConfiguration if the XmlReader was pointing to an instance of it, or null if
95+
* it was pointing to XML null.
96+
* @throws XMLStreamException If an error occurs while reading the CreateSessionConfiguration.
97+
*/
98+
@Generated
99+
public static CreateSessionConfiguration fromXml(XmlReader xmlReader, String rootElementName)
100+
throws XMLStreamException {
101+
String finalRootElementName
102+
= rootElementName == null || rootElementName.isEmpty() ? "CreateSessionRequest" : rootElementName;
103+
return xmlReader.readObject(finalRootElementName, reader -> {
104+
CreateSessionConfiguration deserializedCreateSessionConfiguration = new CreateSessionConfiguration();
105+
while (reader.nextElement() != XmlToken.END_ELEMENT) {
106+
QName elementName = reader.getElementName();
107+
108+
if ("AuthenticationType".equals(elementName.getLocalPart())) {
109+
deserializedCreateSessionConfiguration.authenticationType
110+
= AuthenticationType.fromString(reader.getStringElement());
111+
} else {
112+
reader.skipElement();
113+
}
114+
}
115+
116+
return deserializedCreateSessionConfiguration;
117+
});
118+
}
119+
}

0 commit comments

Comments
 (0)