Ejemplo n.º 1
0
        /// <summary>
        /// Creates an instance of <see cref="BatchClient" />.
        /// </summary>
        /// <param name="credentials">The Batch account credentials.</param>
        /// <returns>An instance of <see cref="Microsoft.Azure.Batch.Protocol.BatchServiceClient"/>.</returns>
        public static BatchClient Open(Auth.BatchSharedKeyCredentials credentials)
        {
            if (null == credentials)
            {
                throw new ArgumentNullException(nameof(credentials));
            }

            return(new BatchClient(credentials));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Blocking call that creates an instance of <see cref="BatchClient"/> associated with the specified credentials.
        /// </summary>
        /// <param name="credentials">The Batch account credentials.</param>
        /// <returns>An instance of <see cref="Microsoft.Azure.Batch.Protocol.BatchServiceClient"/>.</returns>
        public static BatchClient Open(Auth.BatchSharedKeyCredentials credentials)
        {
            using (System.Threading.Tasks.Task <BatchClient> asyncTask = OpenAsync(credentials))
            {
                // wait for completion
                BatchClient bc = asyncTask.WaitAndUnaggregateException();

                return(bc);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates an instance of <see cref="BatchClient"/> associated with the specified credentials.
        /// </summary>
        /// <param name="credentials">The Batch account credentials.</param>
        /// <returns>A <see cref="System.Threading.Tasks.Task"/> object that represents the asynchronous operation.</returns>
        public static System.Threading.Tasks.Task <BatchClient> OpenAsync(Auth.BatchSharedKeyCredentials credentials)
        {
            if (null == credentials)
            {
                throw new ArgumentNullException("credentials");
            }

            BatchClient newBatchCli = new BatchClient(credentials);

            System.Threading.Tasks.Task <BatchClient> retTask = System.Threading.Tasks.Task.FromResult <BatchClient>(newBatchCli);

            return(retTask);
        }
Ejemplo n.º 4
0
 private BatchClient(Auth.BatchSharedKeyCredentials customerCredentials)
     : this()
 {
     Protocol.BatchCredentials proxyCredentials = new Protocol.BatchSharedKeyCredential(customerCredentials.AccountName, customerCredentials.KeyValue);
     this.ProtocolLayer = new ProtocolLayer(customerCredentials.BaseUrl, proxyCredentials);
 }