View Javadoc
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;
6   
7   import com.azure.core.annotations.BodyParam;
8   import com.azure.core.annotations.ExpectedResponses;
9   import com.azure.core.annotations.GET;
10  import com.azure.core.annotations.HeaderParam;
11  import com.azure.core.annotations.Host;
12  import com.azure.core.annotations.HostParam;
13  import com.azure.core.annotations.POST;
14  import com.azure.core.annotations.PUT;
15  import com.azure.core.annotations.QueryParam;
16  import com.azure.core.annotations.Service;
17  import com.azure.core.annotations.UnexpectedResponseExceptionType;
18  import com.azure.core.implementation.RestProxy;
19  import com.azure.core.util.Context;
20  import com.azure.storage.blob.models.KeyInfo;
21  import com.azure.storage.blob.models.ListContainersIncludeType;
22  import com.azure.storage.blob.models.ServicesGetAccountInfoResponse;
23  import com.azure.storage.blob.models.ServicesGetPropertiesResponse;
24  import com.azure.storage.blob.models.ServicesGetStatisticsResponse;
25  import com.azure.storage.blob.models.ServicesGetUserDelegationKeyResponse;
26  import com.azure.storage.blob.models.ServicesListContainersSegmentResponse;
27  import com.azure.storage.blob.models.ServicesSetPropertiesResponse;
28  import com.azure.storage.blob.models.StorageErrorException;
29  import com.azure.storage.blob.models.StorageServiceProperties;
30  import reactor.core.publisher.Mono;
31  
32  /**
33   * An instance of this class provides access to all the operations defined in
34   * Services.
35   */
36  public final class ServicesImpl {
37      /**
38       * The proxy service used to perform REST calls.
39       */
40      private ServicesService service;
41  
42      /**
43       * The service client containing this operation class.
44       */
45      private AzureBlobStorageImpl client;
46  
47      /**
48       * Initializes an instance of ServicesImpl.
49       *
50       * @param client the instance of the service client containing this operation class.
51       */
52      public ServicesImpl(AzureBlobStorageImpl client) {
53          this.service = RestProxy.create(ServicesService.class, client);
54          this.client = client;
55      }
56  
57      /**
58       * The interface defining all the services for Services to be used by the
59       * proxy service to perform REST calls.
60       */
61      @Host("{url}")
62      @Service("Storage Blobs Service")
63      private interface ServicesService {
64          @PUT("")
65          @ExpectedResponses({202})
66          @UnexpectedResponseExceptionType(StorageErrorException.class)
67          Mono<ServicesSetPropertiesResponse> setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") StorageServiceProperties storageServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context);
68  
69          @GET("")
70          @ExpectedResponses({200})
71          @UnexpectedResponseExceptionType(StorageErrorException.class)
72          Mono<ServicesGetPropertiesResponse> getProperties(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context);
73  
74          @GET("")
75          @ExpectedResponses({200})
76          @UnexpectedResponseExceptionType(StorageErrorException.class)
77          Mono<ServicesGetStatisticsResponse> getStatistics(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context);
78  
79          @GET("")
80          @ExpectedResponses({200})
81          @UnexpectedResponseExceptionType(StorageErrorException.class)
82          Mono<ServicesListContainersSegmentResponse> listContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context);
83  
84          @POST("")
85          @ExpectedResponses({200})
86          @UnexpectedResponseExceptionType(StorageErrorException.class)
87          Mono<ServicesGetUserDelegationKeyResponse> getUserDelegationKey(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") KeyInfo keyInfo, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context);
88  
89          @GET("")
90          @ExpectedResponses({200})
91          @UnexpectedResponseExceptionType(StorageErrorException.class)
92          Mono<ServicesGetAccountInfoResponse> getAccountInfo(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context);
93      }
94  
95      /**
96       * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
97       *
98       * @param storageServiceProperties The StorageService properties.
99       * @param context The context to associate with this operation.
100      * @throws IllegalArgumentException thrown if parameters fail the validation.
101      * @return a Mono which performs the network request upon subscription.
102      */
103     public Mono<ServicesSetPropertiesResponse> setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Context context) {
104         final Integer timeout = null;
105         final String requestId = null;
106         final String restype = "service";
107         final String comp = "properties";
108         return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), requestId, restype, comp, context);
109     }
110 
111     /**
112      * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
113      *
114      * @param storageServiceProperties The StorageService properties.
115      * @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations"&gt;Setting Timeouts for Blob Service Operations.&lt;/a&gt;.
116      * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
117      * @param context The context to associate with this operation.
118      * @throws IllegalArgumentException thrown if parameters fail the validation.
119      * @return a Mono which performs the network request upon subscription.
120      */
121     public Mono<ServicesSetPropertiesResponse> setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Integer timeout, String requestId, Context context) {
122         final String restype = "service";
123         final String comp = "properties";
124         return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), requestId, restype, comp, context);
125     }
126 
127     /**
128      * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
129      *
130      * @param context The context to associate with this operation.
131      * @throws IllegalArgumentException thrown if parameters fail the validation.
132      * @return a Mono which performs the network request upon subscription.
133      */
134     public Mono<ServicesGetPropertiesResponse> getPropertiesWithRestResponseAsync(Context context) {
135         final Integer timeout = null;
136         final String requestId = null;
137         final String restype = "service";
138         final String comp = "properties";
139         return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context);
140     }
141 
142     /**
143      * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
144      *
145      * @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations"&gt;Setting Timeouts for Blob Service Operations.&lt;/a&gt;.
146      * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
147      * @param context The context to associate with this operation.
148      * @throws IllegalArgumentException thrown if parameters fail the validation.
149      * @return a Mono which performs the network request upon subscription.
150      */
151     public Mono<ServicesGetPropertiesResponse> getPropertiesWithRestResponseAsync(Integer timeout, String requestId, Context context) {
152         final String restype = "service";
153         final String comp = "properties";
154         return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context);
155     }
156 
157     /**
158      * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account.
159      *
160      * @param context The context to associate with this operation.
161      * @throws IllegalArgumentException thrown if parameters fail the validation.
162      * @return a Mono which performs the network request upon subscription.
163      */
164     public Mono<ServicesGetStatisticsResponse> getStatisticsWithRestResponseAsync(Context context) {
165         final Integer timeout = null;
166         final String requestId = null;
167         final String restype = "service";
168         final String comp = "stats";
169         return service.getStatistics(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context);
170     }
171 
172     /**
173      * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account.
174      *
175      * @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations"&gt;Setting Timeouts for Blob Service Operations.&lt;/a&gt;.
176      * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
177      * @param context The context to associate with this operation.
178      * @throws IllegalArgumentException thrown if parameters fail the validation.
179      * @return a Mono which performs the network request upon subscription.
180      */
181     public Mono<ServicesGetStatisticsResponse> getStatisticsWithRestResponseAsync(Integer timeout, String requestId, Context context) {
182         final String restype = "service";
183         final String comp = "stats";
184         return service.getStatistics(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context);
185     }
186 
187     /**
188      * The List Containers Segment operation returns a list of the containers under the specified account.
189      *
190      * @param context The context to associate with this operation.
191      * @throws IllegalArgumentException thrown if parameters fail the validation.
192      * @return a Mono which performs the network request upon subscription.
193      */
194     public Mono<ServicesListContainersSegmentResponse> listContainersSegmentWithRestResponseAsync(Context context) {
195         final String prefix = null;
196         final String marker = null;
197         final Integer maxresults = null;
198         final ListContainersIncludeType include = null;
199         final Integer timeout = null;
200         final String requestId = null;
201         final String comp = "list";
202         return service.listContainersSegment(this.client.url(), prefix, marker, maxresults, include, timeout, this.client.version(), requestId, comp, context);
203     }
204 
205     /**
206      * The List Containers Segment operation returns a list of the containers under the specified account.
207      *
208      * @param prefix Filters the results to return only containers whose name begins with the specified prefix.
209      * @param marker A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client.
210      * @param maxresults Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000.
211      * @param include Include this parameter to specify that the container's metadata be returned as part of the response body. Possible values include: 'metadata'.
212      * @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations"&gt;Setting Timeouts for Blob Service Operations.&lt;/a&gt;.
213      * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
214      * @param context The context to associate with this operation.
215      * @throws IllegalArgumentException thrown if parameters fail the validation.
216      * @return a Mono which performs the network request upon subscription.
217      */
218     public Mono<ServicesListContainersSegmentResponse> listContainersSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, ListContainersIncludeType include, Integer timeout, String requestId, Context context) {
219         final String comp = "list";
220         return service.listContainersSegment(this.client.url(), prefix, marker, maxresults, include, timeout, this.client.version(), requestId, comp, context);
221     }
222 
223     /**
224      * Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication.
225      *
226      * @param keyInfo the KeyInfo value.
227      * @param context The context to associate with this operation.
228      * @throws IllegalArgumentException thrown if parameters fail the validation.
229      * @return a Mono which performs the network request upon subscription.
230      */
231     public Mono<ServicesGetUserDelegationKeyResponse> getUserDelegationKeyWithRestResponseAsync(KeyInfo keyInfo, Context context) {
232         final Integer timeout = null;
233         final String requestId = null;
234         final String restype = "service";
235         final String comp = "userdelegationkey";
236         return service.getUserDelegationKey(this.client.url(), keyInfo, timeout, this.client.version(), requestId, restype, comp, context);
237     }
238 
239     /**
240      * Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication.
241      *
242      * @param keyInfo the KeyInfo value.
243      * @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations"&gt;Setting Timeouts for Blob Service Operations.&lt;/a&gt;.
244      * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
245      * @param context The context to associate with this operation.
246      * @throws IllegalArgumentException thrown if parameters fail the validation.
247      * @return a Mono which performs the network request upon subscription.
248      */
249     public Mono<ServicesGetUserDelegationKeyResponse> getUserDelegationKeyWithRestResponseAsync(KeyInfo keyInfo, Integer timeout, String requestId, Context context) {
250         final String restype = "service";
251         final String comp = "userdelegationkey";
252         return service.getUserDelegationKey(this.client.url(), keyInfo, timeout, this.client.version(), requestId, restype, comp, context);
253     }
254 
255     /**
256      * Returns the sku name and account kind.
257      *
258      * @param context The context to associate with this operation.
259      * @throws IllegalArgumentException thrown if parameters fail the validation.
260      * @return a Mono which performs the network request upon subscription.
261      */
262     public Mono<ServicesGetAccountInfoResponse> getAccountInfoWithRestResponseAsync(Context context) {
263         final String restype = "account";
264         final String comp = "properties";
265         return service.getAccountInfo(this.client.url(), this.client.version(), restype, comp, context);
266     }
267 }