public static async Task <string> GetContainerIdByNameAsync(this IContainerOperations containerOperations,
                                                                    string containerName)
        {
            var containers = await containerOperations.ListContainersAsync(new ContainersListParameters()).ConfigureAwait(false);

            return(containers.Single(c => c.State == "running" && c.Names.Contains("/" + containerName)).ID);
        }
 /// <summary>
 /// Get the logs for a specified container instance.
 /// </summary>
 /// <remarks>
 /// Get the logs for a specified container instance in a specified resource
 /// group and container group.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='containerGroupName'>
 /// The name of the container group.
 /// </param>
 /// <param name='containerName'>
 /// The name of the container instance.
 /// </param>
 /// <param name='tail'>
 /// The number of lines to show from the tail of the container instance log. If
 /// not provided, all available logs are shown up to 4mb.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Logs> ListLogsAsync(this IContainerOperations operations, string resourceGroupName, string containerGroupName, string containerName, int?tail = default(int?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListLogsWithHttpMessagesAsync(resourceGroupName, containerGroupName, containerName, tail, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Executes a command in a specific container instance.
 /// </summary>
 /// <remarks>
 /// Executes a command for a specific container instance in a specified
 /// resource group and container group.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='containerGroupName'>
 /// The name of the container group.
 /// </param>
 /// <param name='containerName'>
 /// The name of the container instance.
 /// </param>
 /// <param name='containerExecRequest'>
 /// The request for the exec command.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ContainerExecResponse> ExecuteCommandAsync(this IContainerOperations operations, string resourceGroupName, string containerGroupName, string containerName, ContainerExecRequest containerExecRequest, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ExecuteCommandWithHttpMessagesAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// The Begin Refresh Operation triggers an operation in the service
 /// which would discover all the containers in the subscription that
 /// are ready to be protected by your Recovery Services Vault. This is
 /// an asynchronous operation. To determine whether the backend
 /// service has finished processing the request, call Get Refresh
 /// Operation Result APIs.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. Resource group name of your recovery services vault.
 /// </param>
 /// <param name='resourceName'>
 /// Required. Nme of your recovery services vault.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Required. Request header parameters.
 /// </param>
 /// <param name='fabricName'>
 /// Optional. Fabric name for the protection containers.
 /// </param>
 /// <returns>
 /// Base recovery job response for all the asynchronous operations.
 /// </returns>
 public static BaseRecoveryServicesJobResponse BeginRefresh(this IContainerOperations operations, string resourceGroupName, string resourceName, CustomRequestHeaders customRequestHeaders, string fabricName)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IContainerOperations)s).BeginRefreshAsync(resourceGroupName, resourceName, customRequestHeaders, fabricName);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// The Begin Unregister Operation unregisters the given container from
 /// your Recovery Services Vault. This is an asynchronous operation.
 /// To determine whether the backend service has finished processing
 /// the request, call Get Container Operation Result API.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. Resource group name of your recovery services vault.
 /// </param>
 /// <param name='resourceName'>
 /// Required. Name of your recovery services vault.
 /// </param>
 /// <param name='identityName'>
 /// Required. Name of the protection container to unregister.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static AzureOperationResponse Unregister(this IContainerOperations operations, string resourceGroupName, string resourceName, string identityName, CustomRequestHeaders customRequestHeaders)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IContainerOperations)s).UnregisterAsync(resourceGroupName, resourceName, identityName, customRequestHeaders);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Fetches the result of any operation on the container given the ID
 /// of operation.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. Resource group name of your recovery services vault.
 /// </param>
 /// <param name='resourceName'>
 /// Required. Name of your recovery services vault.
 /// </param>
 /// <param name='fabricName'>
 /// Optional. Fabric name of the protected item.
 /// </param>
 /// <param name='containerName'>
 /// Required. Name of the container where the protected item belongs to.
 /// </param>
 /// <param name='operationId'>
 /// Required. ID of the container operation whose result has to be
 /// fetched.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// Protection container response.
 /// </returns>
 public static ProtectionContainerResponse GetContainerOperationResult(this IContainerOperations operations, string resourceGroupName, string resourceName, string fabricName, string containerName, string operationId, CustomRequestHeaders customRequestHeaders)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IContainerOperations)s).GetContainerOperationResultAsync(resourceGroupName, resourceName, fabricName, containerName, operationId, customRequestHeaders);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Fetches the result of any operation on the container given the URL
 /// for tracking the operation as returned by APIs such as Unregister
 /// etc.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='operationResultLink'>
 /// Required. Location value returned by operation.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// Protection container response.
 /// </returns>
 public static ProtectionContainerResponse GetContainerOperationResultByURL(this IContainerOperations operations, string operationResultLink, CustomRequestHeaders customRequestHeaders)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IContainerOperations)s).GetContainerOperationResultByURLAsync(operationResultLink, customRequestHeaders);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Fetches the result of the refresh operation triggered by the Begin
 /// Refresh operation given the URL for tracking the operation as
 /// returned by the Begin Refresh operation.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='operationResultLink'>
 /// Required. Location value returned by operation.
 /// </param>
 /// <returns>
 /// Base recovery job response for all the asynchronous operations.
 /// </returns>
 public static BaseRecoveryServicesJobResponse GetRefreshOperationResultByURL(this IContainerOperations operations, string operationResultLink)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IContainerOperations)s).GetRefreshOperationResultByURLAsync(operationResultLink);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Enable the container reregistration.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.BackupServices.IContainerOperations.
 /// </param>
 /// <param name='containerId'>
 /// Required. MARS container ID.
 /// </param>
 /// <param name='enableReregistrationRequest'>
 /// Required. Enable Reregistration Request.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// The definition of a Operation Response.
 /// </returns>
 public static OperationResponse EnableMarsContainerReregistration(this IContainerOperations operations, string containerId, EnableReregistrationRequest enableReregistrationRequest, CustomRequestHeaders customRequestHeaders)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IContainerOperations)s).EnableMarsContainerReregistrationAsync(containerId, enableReregistrationRequest, customRequestHeaders);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Get the list of all container based on the given query filter
 /// string.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.BackupServices.IContainerOperations.
 /// </param>
 /// <param name='containerType'>
 /// Required. Type of container.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// List of Microsoft Azure Recovery Services (MARS) containers.
 /// </returns>
 public static ListMarsContainerOperationResponse ListMarsContainersByType(this IContainerOperations operations, MarsContainerType containerType, CustomRequestHeaders customRequestHeaders)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IContainerOperations)s).ListMarsContainersByTypeAsync(containerType, customRequestHeaders);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Lists all the containers registered to your Recovery Services Vault
 /// according to the query parameters supplied in the arguments.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. Resource group name of your recovery services vault.
 /// </param>
 /// <param name='resourceName'>
 /// Required. Name of your recovery services vault.
 /// </param>
 /// <param name='queryParams'>
 /// Required. Query parameters for listing protection containers.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Required. Request header parameters.
 /// </param>
 /// <returns>
 /// List of protection containers returned as a response by the list
 /// protection containers API.
 /// </returns>
 public static ProtectionContainerListResponse List(this IContainerOperations operations, string resourceGroupName, string resourceName, ProtectionContainerListQueryParams queryParams, CustomRequestHeaders customRequestHeaders)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IContainerOperations)s).ListAsync(resourceGroupName, resourceName, queryParams, customRequestHeaders);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Initializes a new instance of the
 /// BackupVaultServicesManagementClient class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 public BackupVaultServicesManagementClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._container  = new ContainerOperations(this);
     this._vault      = new VaultOperations(this);
     this._apiVersion = "2013-03-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
        public static async Task <string> GetFileContentFromContainerAsync(this IContainerOperations containerOperations,
                                                                           string containerId, string sourcePath)
        {
            var response = await containerOperations.GetArchiveFromContainerAsync(containerId, new GetArchiveFromContainerParameters
            {
                Path = sourcePath
            }, false).ConfigureAwait(false);

            return(await ArchiveHelper.ExtractSingleFileFromTarToStringAsync(response.Stream));
        }
        public static async Task UploadTarredFileToContainerAsync(this IContainerOperations containerOperations,
                                                                  MemoryStream tarredFileStream, string containerName, string destinationPath)
        {
            var id = await containerOperations.GetContainerIdByNameAsync(containerName).ConfigureAwait(false);

            tarredFileStream.Position = 0;
            await containerOperations.ExtractArchiveToContainerAsync(
                id,
                new ContainerPathStatParameters { AllowOverwriteDirWithFile = true, Path = destinationPath },
                tarredFileStream).ConfigureAwait(false);
        }
        public static async Task <string> GetEntireContainerLogAsync(this IContainerOperations containerOperations, string containerId)
        {
            ContainerLogsParameters logParameters = new ContainerLogsParameters
            {
                ShowStdout = true,
                ShowStderr = true,
                Follow     = false
            };

            using (Stream logStream = await containerOperations.GetContainerLogsAsync(containerId, logParameters, CancellationToken.None))
                using (StreamReader logReader = new StreamReader(logStream))
                {
                    return(logReader.ReadToEnd() ?? String.Empty);
                }
        }
 /// <summary>
 /// Initializes a new instance of the BackupServicesManagementClient
 /// class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 public BackupServicesManagementClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._backUp              = new BackUpOperations(this);
     this._container           = new ContainerOperations(this);
     this._cSMProtectionPolicy = new CSMProtectionPolicyOperations(this);
     this._dataSource          = new DataSourceOperations(this);
     this._job               = new JobOperations(this);
     this._operationStatus   = new OperationStatus(this);
     this._protectableObject = new ProtectableObjectOperations(this);
     this._recoveryPoint     = new RecoveryPointOperations(this);
     this._restore           = new RestoreOperations(this);
     this._apiVersion        = "2013-03-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 protected override void Initialize()
 {
     ContainerGroups     = new ContainerGroupsOperations(this);
     Operations          = new Operations(this);
     ContainerGroupUsage = new ContainerGroupUsageOperations(this);
     Container           = new ContainerOperations(this);
     BaseUri             = new System.Uri("https://management.azure.com");
     ApiVersion          = "2018-10-01";
     AcceptLanguage      = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
     DeserializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }
        public static async Task <bool> WaitForContainerTerminationAsync(this IContainerOperations containerOperations, string containerId)
        {
            TimeSpan timeout = TimeSpan.FromMinutes(30);
            DateTime then    = DateTime.Now;
            DateTime now     = DateTime.Now;

            while ((now - then) < timeout)
            {
                ContainerInspectResponse containerState = await containerOperations.InspectContainerAsync(containerId);

                if (containerState.State.Status == "exited")
                {
                    return(true);
                }

                await Task.Delay(
                    TimeSpan.FromSeconds(2)
                    );

                now = DateTime.Now;
            }

            return(false);
        }
 /// <summary>
 /// Lists all the containers registered to your Recovery Services Vault
 /// according to the query parameters supplied in the arguments.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. Resource group name of your recovery services vault.
 /// </param>
 /// <param name='resourceName'>
 /// Required. Name of your recovery services vault.
 /// </param>
 /// <param name='queryParams'>
 /// Required. Query parameters for listing protection containers.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Required. Request header parameters.
 /// </param>
 /// <returns>
 /// List of protection containers returned as a response by the list
 /// protection containers API.
 /// </returns>
 public static Task <ProtectionContainerListResponse> ListAsync(this IContainerOperations operations, string resourceGroupName, string resourceName, ProtectionContainerListQueryParams queryParams, CustomRequestHeaders customRequestHeaders)
 {
     return(operations.ListAsync(resourceGroupName, resourceName, queryParams, customRequestHeaders, CancellationToken.None));
 }
 /// <summary>
 /// Fetches the result of the refresh operation triggered by the Begin
 /// Refresh operation given the URL for tracking the operation as
 /// returned by the Begin Refresh operation.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='operationResultLink'>
 /// Required. Location value returned by operation.
 /// </param>
 /// <returns>
 /// Base recovery job response for all the asynchronous operations.
 /// </returns>
 public static Task <BaseRecoveryServicesJobResponse> GetRefreshOperationResultByURLAsync(this IContainerOperations operations, string operationResultLink)
 {
     return(operations.GetRefreshOperationResultByURLAsync(operationResultLink, CancellationToken.None));
 }
Example #21
0
 /// <summary>
 /// Get the list of all container based on the given query filter
 /// string.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.BackupServices.IContainerOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required.
 /// </param>
 /// <param name='resourceName'>
 /// Required.
 /// </param>
 /// <param name='parameters'>
 /// Optional. Container query parameters.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// The definition of a CSMContainerListOperationResponse.
 /// </returns>
 public static Task <CSMContainerListOperationResponse> ListAsync(this IContainerOperations operations, string resourceGroupName, string resourceName, ContainerQueryParameters parameters, CustomRequestHeaders customRequestHeaders)
 {
     return(operations.ListAsync(resourceGroupName, resourceName, parameters, customRequestHeaders, CancellationToken.None));
 }
 /// <summary>
 /// Fetches the result of any operation on the container given the URL
 /// for tracking the operation as returned by APIs such as Unregister
 /// etc.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='operationResultLink'>
 /// Required. Location value returned by operation.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// Protection container response.
 /// </returns>
 public static Task <ProtectionContainerResponse> GetContainerOperationResultByURLAsync(this IContainerOperations operations, string operationResultLink, CustomRequestHeaders customRequestHeaders)
 {
     return(operations.GetContainerOperationResultByURLAsync(operationResultLink, customRequestHeaders, CancellationToken.None));
 }
 /// <summary>
 /// Executes a command in a specific container instance.
 /// </summary>
 /// <remarks>
 /// Executes a command for a specific container instance in a specified
 /// resource group and container group.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='containerGroupName'>
 /// The name of the container group.
 /// </param>
 /// <param name='containerName'>
 /// The name of the container instance.
 /// </param>
 /// <param name='containerExecRequest'>
 /// The request for the exec command.
 /// </param>
 public static ContainerExecResponse ExecuteCommand(this IContainerOperations operations, string resourceGroupName, string containerGroupName, string containerName, ContainerExecRequest containerExecRequest)
 {
     return(operations.ExecuteCommandAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Fetches the result of any operation on the container given the ID
 /// of operation.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. Resource group name of your recovery services vault.
 /// </param>
 /// <param name='resourceName'>
 /// Required. Name of your recovery services vault.
 /// </param>
 /// <param name='fabricName'>
 /// Optional. Fabric name of the protected item.
 /// </param>
 /// <param name='containerName'>
 /// Required. Name of the container where the protected item belongs to.
 /// </param>
 /// <param name='operationId'>
 /// Required. ID of the container operation whose result has to be
 /// fetched.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// Protection container response.
 /// </returns>
 public static Task <ProtectionContainerResponse> GetContainerOperationResultAsync(this IContainerOperations operations, string resourceGroupName, string resourceName, string fabricName, string containerName, string operationId, CustomRequestHeaders customRequestHeaders)
 {
     return(operations.GetContainerOperationResultAsync(resourceGroupName, resourceName, fabricName, containerName, operationId, customRequestHeaders, CancellationToken.None));
 }
 /// <summary>
 /// Get the logs for a specified container instance.
 /// </summary>
 /// <remarks>
 /// Get the logs for a specified container instance in a specified resource
 /// group and container group.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='containerGroupName'>
 /// The name of the container group.
 /// </param>
 /// <param name='containerName'>
 /// The name of the container instance.
 /// </param>
 /// <param name='tail'>
 /// The number of lines to show from the tail of the container instance log. If
 /// not provided, all available logs are shown up to 4mb.
 /// </param>
 public static Logs ListLogs(this IContainerOperations operations, string resourceGroupName, string containerGroupName, string containerName, int?tail = default(int?))
 {
     return(operations.ListLogsAsync(resourceGroupName, containerGroupName, containerName, tail).GetAwaiter().GetResult());
 }
 public static void RemoveContainer(this IContainerOperations operations, string name, ContainerRemoveParameters parameters)
 {
     operations.RemoveContainerAsync(name, parameters).Wait();
 }
 /// <summary>
 /// The Begin Unregister Operation unregisters the given container from
 /// your Recovery Services Vault. This is an asynchronous operation.
 /// To determine whether the backend service has finished processing
 /// the request, call Get Container Operation Result API.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. Resource group name of your recovery services vault.
 /// </param>
 /// <param name='resourceName'>
 /// Required. Name of your recovery services vault.
 /// </param>
 /// <param name='identityName'>
 /// Required. Name of the protection container to unregister.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task <AzureOperationResponse> UnregisterAsync(this IContainerOperations operations, string resourceGroupName, string resourceName, string identityName, CustomRequestHeaders customRequestHeaders)
 {
     return(operations.UnregisterAsync(resourceGroupName, resourceName, identityName, customRequestHeaders, CancellationToken.None));
 }
 public static CreateContainerResponse CreateContainer(this IContainerOperations operations, CreateContainerParameters parameters)
 {
     return(operations.CreateContainerAsync(parameters).Result);
 }
 /// <summary>
 /// The Begin Refresh Operation triggers an operation in the service
 /// which would discover all the containers in the subscription that
 /// are ready to be protected by your Recovery Services Vault. This is
 /// an asynchronous operation. To determine whether the backend
 /// service has finished processing the request, call Get Refresh
 /// Operation Result APIs.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.RecoveryServices.Backup.IContainerOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. Resource group name of your recovery services vault.
 /// </param>
 /// <param name='resourceName'>
 /// Required. Nme of your recovery services vault.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Required. Request header parameters.
 /// </param>
 /// <param name='fabricName'>
 /// Optional. Fabric name for the protection containers.
 /// </param>
 /// <returns>
 /// Base recovery job response for all the asynchronous operations.
 /// </returns>
 public static Task <BaseRecoveryServicesJobResponse> BeginRefreshAsync(this IContainerOperations operations, string resourceGroupName, string resourceName, CustomRequestHeaders customRequestHeaders, string fabricName)
 {
     return(operations.BeginRefreshAsync(resourceGroupName, resourceName, customRequestHeaders, fabricName, CancellationToken.None));
 }
 public static IList <ContainerListResponse> ListContainers(this IContainerOperations operations, ContainersListParameters parameters)
 {
     return(operations.ListContainersAsync(parameters).Result);
 }