com.azure.core.annotation.BodyParam Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-core Show documentation
Show all versions of azure-core Show documentation
This package contains core types for Azure Java clients.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.core.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Annotation to annotate a parameter to send to a REST endpoint as HTTP Request content.
*
* If the parameter type extends InputStream
, this payload is streamed to server through
* "application/octet-stream". Otherwise, the body is serialized first and sent as "application/json" or
* "application/xml", based on the serializer.
*
*
* Example 1: Put JSON
*
*
*
* @Put("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/"
* + "virtualMachines/{vmName}")
* VirtualMachine createOrUpdate(@PathParam("resourceGroupName") String rgName,
* @PathParam("vmName") String vmName,
* @PathParam("subscriptionId") String subscriptionId,
* @BodyParam("application/json") VirtualMachine vm);
*
*
*
* Example 2: Stream
*
*
*
* @Post("formdata/stream/uploadfile")
* void uploadFileViaBody(@BodyParam("application/octet-stream") FileInputStream fileContent);
*
*
*/
@Retention(RUNTIME)
@Target(PARAMETER)
public @interface BodyParam {
/**
* Gets the Content-Type for the body.
*
* @return The Content-Type for the body.
*/
String value();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy