com.azure.resourcemanager.mediaservices.implementation.TransformsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-mediaservices Show documentation
Show all versions of azure-resourcemanager-mediaservices Show documentation
This package contains Microsoft Azure SDK for MediaServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This Swagger was generated by the API Framework. Package tag package-account-2023-01.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.mediaservices.implementation;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.mediaservices.fluent.TransformsClient;
import com.azure.resourcemanager.mediaservices.fluent.models.TransformInner;
import com.azure.resourcemanager.mediaservices.models.Transform;
import com.azure.resourcemanager.mediaservices.models.Transforms;
public final class TransformsImpl implements Transforms {
private static final ClientLogger LOGGER = new ClientLogger(TransformsImpl.class);
private final TransformsClient innerClient;
private final com.azure.resourcemanager.mediaservices.MediaServicesManager serviceManager;
public TransformsImpl(
TransformsClient innerClient, com.azure.resourcemanager.mediaservices.MediaServicesManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable list(String resourceGroupName, String accountName) {
PagedIterable inner = this.serviceClient().list(resourceGroupName, accountName);
return Utils.mapPage(inner, inner1 -> new TransformImpl(inner1, this.manager()));
}
public PagedIterable list(
String resourceGroupName, String accountName, String filter, String orderby, Context context) {
PagedIterable inner =
this.serviceClient().list(resourceGroupName, accountName, filter, orderby, context);
return Utils.mapPage(inner, inner1 -> new TransformImpl(inner1, this.manager()));
}
public Transform get(String resourceGroupName, String accountName, String transformName) {
TransformInner inner = this.serviceClient().get(resourceGroupName, accountName, transformName);
if (inner != null) {
return new TransformImpl(inner, this.manager());
} else {
return null;
}
}
public Response getWithResponse(
String resourceGroupName, String accountName, String transformName, Context context) {
Response inner =
this.serviceClient().getWithResponse(resourceGroupName, accountName, transformName, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new TransformImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public void delete(String resourceGroupName, String accountName, String transformName) {
this.serviceClient().delete(resourceGroupName, accountName, transformName);
}
public Response deleteWithResponse(
String resourceGroupName, String accountName, String transformName, Context context) {
return this.serviceClient().deleteWithResponse(resourceGroupName, accountName, transformName, context);
}
public Transform getById(String id) {
String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String
.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String accountName = Utils.getValueFromIdByName(id, "mediaServices");
if (accountName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'mediaServices'.", id)));
}
String transformName = Utils.getValueFromIdByName(id, "transforms");
if (transformName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'transforms'.", id)));
}
return this.getWithResponse(resourceGroupName, accountName, transformName, Context.NONE).getValue();
}
public Response getByIdWithResponse(String id, Context context) {
String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String
.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String accountName = Utils.getValueFromIdByName(id, "mediaServices");
if (accountName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'mediaServices'.", id)));
}
String transformName = Utils.getValueFromIdByName(id, "transforms");
if (transformName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'transforms'.", id)));
}
return this.getWithResponse(resourceGroupName, accountName, transformName, context);
}
public void deleteById(String id) {
String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String
.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String accountName = Utils.getValueFromIdByName(id, "mediaServices");
if (accountName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'mediaServices'.", id)));
}
String transformName = Utils.getValueFromIdByName(id, "transforms");
if (transformName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'transforms'.", id)));
}
this.deleteWithResponse(resourceGroupName, accountName, transformName, Context.NONE);
}
public Response deleteByIdWithResponse(String id, Context context) {
String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
if (resourceGroupName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String
.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
}
String accountName = Utils.getValueFromIdByName(id, "mediaServices");
if (accountName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'mediaServices'.", id)));
}
String transformName = Utils.getValueFromIdByName(id, "transforms");
if (transformName == null) {
throw LOGGER
.logExceptionAsError(
new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'transforms'.", id)));
}
return this.deleteWithResponse(resourceGroupName, accountName, transformName, context);
}
private TransformsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.mediaservices.MediaServicesManager manager() {
return this.serviceManager;
}
public TransformImpl define(String name) {
return new TransformImpl(name, this.manager());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy