All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.mediaservices.implementation.AssetImpl Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.4.0-beta.2
Show 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.Response;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.mediaservices.fluent.models.AssetInner;
import com.azure.resourcemanager.mediaservices.models.Asset;
import com.azure.resourcemanager.mediaservices.models.AssetContainerSas;
import com.azure.resourcemanager.mediaservices.models.AssetStorageEncryptionFormat;
import com.azure.resourcemanager.mediaservices.models.ListContainerSasInput;
import com.azure.resourcemanager.mediaservices.models.ListStreamingLocatorsResponse;
import com.azure.resourcemanager.mediaservices.models.StorageEncryptedAssetDecryptionData;
import java.time.OffsetDateTime;
import java.util.UUID;

public final class AssetImpl implements Asset, Asset.Definition, Asset.Update {
    private AssetInner innerObject;

    private final com.azure.resourcemanager.mediaservices.MediaServicesManager serviceManager;

    public String id() {
        return this.innerModel().id();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public UUID assetId() {
        return this.innerModel().assetId();
    }

    public OffsetDateTime created() {
        return this.innerModel().created();
    }

    public OffsetDateTime lastModified() {
        return this.innerModel().lastModified();
    }

    public String alternateId() {
        return this.innerModel().alternateId();
    }

    public String description() {
        return this.innerModel().description();
    }

    public String container() {
        return this.innerModel().container();
    }

    public String storageAccountName() {
        return this.innerModel().storageAccountName();
    }

    public AssetStorageEncryptionFormat storageEncryptionFormat() {
        return this.innerModel().storageEncryptionFormat();
    }

    public String resourceGroupName() {
        return resourceGroupName;
    }

    public AssetInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.mediaservices.MediaServicesManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String accountName;

    private String assetName;

    public AssetImpl withExistingMediaService(String resourceGroupName, String accountName) {
        this.resourceGroupName = resourceGroupName;
        this.accountName = accountName;
        return this;
    }

    public Asset create() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getAssets()
                .createOrUpdateWithResponse(resourceGroupName, accountName, assetName, this.innerModel(), Context.NONE)
                .getValue();
        return this;
    }

    public Asset create(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getAssets()
                .createOrUpdateWithResponse(resourceGroupName, accountName, assetName, this.innerModel(), context)
                .getValue();
        return this;
    }

    AssetImpl(String name, com.azure.resourcemanager.mediaservices.MediaServicesManager serviceManager) {
        this.innerObject = new AssetInner();
        this.serviceManager = serviceManager;
        this.assetName = name;
    }

    public AssetImpl update() {
        return this;
    }

    public Asset apply() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getAssets()
                .updateWithResponse(resourceGroupName, accountName, assetName, this.innerModel(), Context.NONE)
                .getValue();
        return this;
    }

    public Asset apply(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getAssets()
                .updateWithResponse(resourceGroupName, accountName, assetName, this.innerModel(), context)
                .getValue();
        return this;
    }

    AssetImpl(AssetInner innerObject, com.azure.resourcemanager.mediaservices.MediaServicesManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.accountName = Utils.getValueFromIdByName(innerObject.id(), "mediaServices");
        this.assetName = Utils.getValueFromIdByName(innerObject.id(), "assets");
    }

    public Asset refresh() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getAssets()
                .getWithResponse(resourceGroupName, accountName, assetName, Context.NONE)
                .getValue();
        return this;
    }

    public Asset refresh(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getAssets()
                .getWithResponse(resourceGroupName, accountName, assetName, context)
                .getValue();
        return this;
    }

    public AssetContainerSas listContainerSas(ListContainerSasInput parameters) {
        return serviceManager.assets().listContainerSas(resourceGroupName, accountName, assetName, parameters);
    }

    public Response listContainerSasWithResponse(ListContainerSasInput parameters, Context context) {
        return serviceManager
            .assets()
            .listContainerSasWithResponse(resourceGroupName, accountName, assetName, parameters, context);
    }

    public StorageEncryptedAssetDecryptionData getEncryptionKey() {
        return serviceManager.assets().getEncryptionKey(resourceGroupName, accountName, assetName);
    }

    public Response getEncryptionKeyWithResponse(Context context) {
        return serviceManager.assets().getEncryptionKeyWithResponse(resourceGroupName, accountName, assetName, context);
    }

    public ListStreamingLocatorsResponse listStreamingLocators() {
        return serviceManager.assets().listStreamingLocators(resourceGroupName, accountName, assetName);
    }

    public Response listStreamingLocatorsWithResponse(Context context) {
        return serviceManager
            .assets()
            .listStreamingLocatorsWithResponse(resourceGroupName, accountName, assetName, context);
    }

    public AssetImpl withAlternateId(String alternateId) {
        this.innerModel().withAlternateId(alternateId);
        return this;
    }

    public AssetImpl withDescription(String description) {
        this.innerModel().withDescription(description);
        return this;
    }

    public AssetImpl withContainer(String container) {
        this.innerModel().withContainer(container);
        return this;
    }

    public AssetImpl withStorageAccountName(String storageAccountName) {
        this.innerModel().withStorageAccountName(storageAccountName);
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy