com.azure.resourcemanager.mediaservices.implementation.AssetsImpl 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.
The newest version!
// 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.AssetsClient;
import com.azure.resourcemanager.mediaservices.fluent.models.AssetContainerSasInner;
import com.azure.resourcemanager.mediaservices.fluent.models.AssetInner;
import com.azure.resourcemanager.mediaservices.fluent.models.ListStreamingLocatorsResponseInner;
import com.azure.resourcemanager.mediaservices.fluent.models.StorageEncryptedAssetDecryptionDataInner;
import com.azure.resourcemanager.mediaservices.models.Asset;
import com.azure.resourcemanager.mediaservices.models.AssetContainerSas;
import com.azure.resourcemanager.mediaservices.models.Assets;
import com.azure.resourcemanager.mediaservices.models.ListContainerSasInput;
import com.azure.resourcemanager.mediaservices.models.ListStreamingLocatorsResponse;
import com.azure.resourcemanager.mediaservices.models.StorageEncryptedAssetDecryptionData;
public final class AssetsImpl implements Assets {
private static final ClientLogger LOGGER = new ClientLogger(AssetsImpl.class);
private final AssetsClient innerClient;
private final com.azure.resourcemanager.mediaservices.MediaServicesManager serviceManager;
public AssetsImpl(AssetsClient 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 ResourceManagerUtils.mapPage(inner, inner1 -> new AssetImpl(inner1, this.manager()));
}
public PagedIterable list(String resourceGroupName, String accountName, String filter, Integer top,
String orderby, Context context) {
PagedIterable inner
= this.serviceClient().list(resourceGroupName, accountName, filter, top, orderby, context);
return ResourceManagerUtils.mapPage(inner, inner1 -> new AssetImpl(inner1, this.manager()));
}
public Response getWithResponse(String resourceGroupName, String accountName, String assetName,
Context context) {
Response inner
= this.serviceClient().getWithResponse(resourceGroupName, accountName, assetName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new AssetImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public Asset get(String resourceGroupName, String accountName, String assetName) {
AssetInner inner = this.serviceClient().get(resourceGroupName, accountName, assetName);
if (inner != null) {
return new AssetImpl(inner, this.manager());
} else {
return null;
}
}
public Response deleteWithResponse(String resourceGroupName, String accountName, String assetName,
Context context) {
return this.serviceClient().deleteWithResponse(resourceGroupName, accountName, assetName, context);
}
public void delete(String resourceGroupName, String accountName, String assetName) {
this.serviceClient().delete(resourceGroupName, accountName, assetName);
}
public Response listContainerSasWithResponse(String resourceGroupName, String accountName,
String assetName, ListContainerSasInput parameters, Context context) {
Response inner = this.serviceClient()
.listContainerSasWithResponse(resourceGroupName, accountName, assetName, parameters, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new AssetContainerSasImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public AssetContainerSas listContainerSas(String resourceGroupName, String accountName, String assetName,
ListContainerSasInput parameters) {
AssetContainerSasInner inner
= this.serviceClient().listContainerSas(resourceGroupName, accountName, assetName, parameters);
if (inner != null) {
return new AssetContainerSasImpl(inner, this.manager());
} else {
return null;
}
}
public Response getEncryptionKeyWithResponse(String resourceGroupName,
String accountName, String assetName, Context context) {
Response inner
= this.serviceClient().getEncryptionKeyWithResponse(resourceGroupName, accountName, assetName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new StorageEncryptedAssetDecryptionDataImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public StorageEncryptedAssetDecryptionData getEncryptionKey(String resourceGroupName, String accountName,
String assetName) {
StorageEncryptedAssetDecryptionDataInner inner
= this.serviceClient().getEncryptionKey(resourceGroupName, accountName, assetName);
if (inner != null) {
return new StorageEncryptedAssetDecryptionDataImpl(inner, this.manager());
} else {
return null;
}
}
public Response listStreamingLocatorsWithResponse(String resourceGroupName,
String accountName, String assetName, Context context) {
Response inner = this.serviceClient()
.listStreamingLocatorsWithResponse(resourceGroupName, accountName, assetName, context);
if (inner != null) {
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
new ListStreamingLocatorsResponseImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public ListStreamingLocatorsResponse listStreamingLocators(String resourceGroupName, String accountName,
String assetName) {
ListStreamingLocatorsResponseInner inner
= this.serviceClient().listStreamingLocators(resourceGroupName, accountName, assetName);
if (inner != null) {
return new ListStreamingLocatorsResponseImpl(inner, this.manager());
} else {
return null;
}
}
public Asset getById(String id) {
String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 assetName = ResourceManagerUtils.getValueFromIdByName(id, "assets");
if (assetName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'assets'.", id)));
}
return this.getWithResponse(resourceGroupName, accountName, assetName, Context.NONE).getValue();
}
public Response getByIdWithResponse(String id, Context context) {
String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 assetName = ResourceManagerUtils.getValueFromIdByName(id, "assets");
if (assetName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'assets'.", id)));
}
return this.getWithResponse(resourceGroupName, accountName, assetName, context);
}
public void deleteById(String id) {
String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 assetName = ResourceManagerUtils.getValueFromIdByName(id, "assets");
if (assetName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'assets'.", id)));
}
this.deleteWithResponse(resourceGroupName, accountName, assetName, Context.NONE);
}
public Response deleteByIdWithResponse(String id, Context context) {
String resourceGroupName = ResourceManagerUtils.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 = ResourceManagerUtils.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 assetName = ResourceManagerUtils.getValueFromIdByName(id, "assets");
if (assetName == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
String.format("The resource ID '%s' is not valid. Missing path segment 'assets'.", id)));
}
return this.deleteWithResponse(resourceGroupName, accountName, assetName, context);
}
private AssetsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.mediaservices.MediaServicesManager manager() {
return this.serviceManager;
}
public AssetImpl define(String name) {
return new AssetImpl(name, this.manager());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy