|
| 1 | +package com.microsoft.graph.devices.provision; |
| 2 | + |
| 3 | +import com.microsoft.graph.models.odataerrors.ODataError; |
| 4 | +import com.microsoft.graph.models.ProvisionResponse; |
| 5 | +import com.microsoft.kiota.BaseRequestBuilder; |
| 6 | +import com.microsoft.kiota.BaseRequestConfiguration; |
| 7 | +import com.microsoft.kiota.HttpMethod; |
| 8 | +import com.microsoft.kiota.RequestAdapter; |
| 9 | +import com.microsoft.kiota.RequestInformation; |
| 10 | +import com.microsoft.kiota.RequestOption; |
| 11 | +import com.microsoft.kiota.serialization.Parsable; |
| 12 | +import com.microsoft.kiota.serialization.ParsableFactory; |
| 13 | +import java.util.Collection; |
| 14 | +import java.util.HashMap; |
| 15 | +import java.util.Map; |
| 16 | +import java.util.Objects; |
| 17 | +/** |
| 18 | + * Provides operations to call the provision method. |
| 19 | + */ |
| 20 | +@jakarta.annotation.Generated("com.microsoft.kiota") |
| 21 | +public class ProvisionRequestBuilder extends BaseRequestBuilder { |
| 22 | + /** |
| 23 | + * Instantiates a new {@link ProvisionRequestBuilder} and sets the default values. |
| 24 | + * @param pathParameters Path parameters for the request |
| 25 | + * @param requestAdapter The request adapter to use to execute the requests. |
| 26 | + */ |
| 27 | + public ProvisionRequestBuilder(@jakarta.annotation.Nonnull final HashMap<String, Object> pathParameters, @jakarta.annotation.Nonnull final RequestAdapter requestAdapter) { |
| 28 | + super(requestAdapter, "{+baseurl}/devices/provision", pathParameters); |
| 29 | + } |
| 30 | + /** |
| 31 | + * Instantiates a new {@link ProvisionRequestBuilder} and sets the default values. |
| 32 | + * @param rawUrl The raw URL to use for the request builder. |
| 33 | + * @param requestAdapter The request adapter to use to execute the requests. |
| 34 | + */ |
| 35 | + public ProvisionRequestBuilder(@jakarta.annotation.Nonnull final String rawUrl, @jakarta.annotation.Nonnull final RequestAdapter requestAdapter) { |
| 36 | + super(requestAdapter, "{+baseurl}/devices/provision", rawUrl); |
| 37 | + } |
| 38 | + /** |
| 39 | + * Provision a device on behalf of an approved Virtual Desktop Infrastructure (VDI) provider. This action wraps the Zero Touch Deployment (ZTD) protocol to create a device in a pending state in the customer's directory. The device can't be used for authentication until it completes its registration. The created device is stamped with a system label that identifies the approved VDI provider. Only VDI applications on Microsoft's approved list of VDI providers can successfully call this action. Calls from other applications are blocked even when the application is granted the required permission. |
| 40 | + * @param body The request body |
| 41 | + * @return a {@link ProvisionResponse} |
| 42 | + * @throws ODataError When receiving a 4XX or 5XX status code |
| 43 | + * @see <a href="https://learn.microsoft.com/graph/api/device-provision?view=graph-rest-1.0">Find more info here</a> |
| 44 | + */ |
| 45 | + @jakarta.annotation.Nullable |
| 46 | + public ProvisionResponse post(@jakarta.annotation.Nonnull final ProvisionPostRequestBody body) { |
| 47 | + return post(body, null); |
| 48 | + } |
| 49 | + /** |
| 50 | + * Provision a device on behalf of an approved Virtual Desktop Infrastructure (VDI) provider. This action wraps the Zero Touch Deployment (ZTD) protocol to create a device in a pending state in the customer's directory. The device can't be used for authentication until it completes its registration. The created device is stamped with a system label that identifies the approved VDI provider. Only VDI applications on Microsoft's approved list of VDI providers can successfully call this action. Calls from other applications are blocked even when the application is granted the required permission. |
| 51 | + * @param body The request body |
| 52 | + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 53 | + * @return a {@link ProvisionResponse} |
| 54 | + * @throws ODataError When receiving a 4XX or 5XX status code |
| 55 | + * @see <a href="https://learn.microsoft.com/graph/api/device-provision?view=graph-rest-1.0">Find more info here</a> |
| 56 | + */ |
| 57 | + @jakarta.annotation.Nullable |
| 58 | + public ProvisionResponse post(@jakarta.annotation.Nonnull final ProvisionPostRequestBody body, @jakarta.annotation.Nullable final java.util.function.Consumer<PostRequestConfiguration> requestConfiguration) { |
| 59 | + Objects.requireNonNull(body); |
| 60 | + final RequestInformation requestInfo = toPostRequestInformation(body, requestConfiguration); |
| 61 | + final HashMap<String, ParsableFactory<? extends Parsable>> errorMapping = new HashMap<String, ParsableFactory<? extends Parsable>>(); |
| 62 | + errorMapping.put("XXX", ODataError::createFromDiscriminatorValue); |
| 63 | + return this.requestAdapter.send(requestInfo, errorMapping, ProvisionResponse::createFromDiscriminatorValue); |
| 64 | + } |
| 65 | + /** |
| 66 | + * Provision a device on behalf of an approved Virtual Desktop Infrastructure (VDI) provider. This action wraps the Zero Touch Deployment (ZTD) protocol to create a device in a pending state in the customer's directory. The device can't be used for authentication until it completes its registration. The created device is stamped with a system label that identifies the approved VDI provider. Only VDI applications on Microsoft's approved list of VDI providers can successfully call this action. Calls from other applications are blocked even when the application is granted the required permission. |
| 67 | + * @param body The request body |
| 68 | + * @return a {@link RequestInformation} |
| 69 | + */ |
| 70 | + @jakarta.annotation.Nonnull |
| 71 | + public RequestInformation toPostRequestInformation(@jakarta.annotation.Nonnull final ProvisionPostRequestBody body) { |
| 72 | + return toPostRequestInformation(body, null); |
| 73 | + } |
| 74 | + /** |
| 75 | + * Provision a device on behalf of an approved Virtual Desktop Infrastructure (VDI) provider. This action wraps the Zero Touch Deployment (ZTD) protocol to create a device in a pending state in the customer's directory. The device can't be used for authentication until it completes its registration. The created device is stamped with a system label that identifies the approved VDI provider. Only VDI applications on Microsoft's approved list of VDI providers can successfully call this action. Calls from other applications are blocked even when the application is granted the required permission. |
| 76 | + * @param body The request body |
| 77 | + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. |
| 78 | + * @return a {@link RequestInformation} |
| 79 | + */ |
| 80 | + @jakarta.annotation.Nonnull |
| 81 | + public RequestInformation toPostRequestInformation(@jakarta.annotation.Nonnull final ProvisionPostRequestBody body, @jakarta.annotation.Nullable final java.util.function.Consumer<PostRequestConfiguration> requestConfiguration) { |
| 82 | + Objects.requireNonNull(body); |
| 83 | + final RequestInformation requestInfo = new RequestInformation(HttpMethod.POST, urlTemplate, pathParameters); |
| 84 | + requestInfo.configure(requestConfiguration, PostRequestConfiguration::new); |
| 85 | + requestInfo.headers.tryAdd("Accept", "application/json"); |
| 86 | + requestInfo.setContentFromParsable(requestAdapter, "application/json", body); |
| 87 | + return requestInfo; |
| 88 | + } |
| 89 | + /** |
| 90 | + * Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 91 | + * @param rawUrl The raw URL to use for the request builder. |
| 92 | + * @return a {@link ProvisionRequestBuilder} |
| 93 | + */ |
| 94 | + @jakarta.annotation.Nonnull |
| 95 | + public ProvisionRequestBuilder withUrl(@jakarta.annotation.Nonnull final String rawUrl) { |
| 96 | + Objects.requireNonNull(rawUrl); |
| 97 | + return new ProvisionRequestBuilder(rawUrl, requestAdapter); |
| 98 | + } |
| 99 | + /** |
| 100 | + * Configuration for the request such as headers, query parameters, and middleware options. |
| 101 | + */ |
| 102 | + @jakarta.annotation.Generated("com.microsoft.kiota") |
| 103 | + public class PostRequestConfiguration extends BaseRequestConfiguration { |
| 104 | + } |
| 105 | +} |
0 commit comments