protected override void ProcessRecord()
 {
     base.ProcessRecord();
     try
     {
         client?.Dispose();
         int timeout = GetPreferredTimeout();
         WriteDebug($"Cmdlet Timeout : {timeout} milliseconds.");
         client = new MarketplaceClient(AuthProvider, new Oci.Common.ClientConfiguration
         {
             RetryConfiguration = retryConfig,
             TimeoutMillis      = timeout,
             ClientUserAgent    = PSUserAgent
         });
         string region = GetPreferredRegion();
         if (region != null)
         {
             WriteDebug("Choosing Region:" + region);
             client.SetRegion(region);
         }
         if (Endpoint != null)
         {
             WriteDebug("Choosing Endpoint:" + Endpoint);
             client.SetEndpoint(Endpoint);
         }
     }
     catch (Exception ex)
     {
         TerminatingErrorDuringExecution(ex);
     }
 }
 public DiscogsClient(IApiConnection apiConnection)
 {
     ApiConnection  = apiConnection;
     Authentication = new AuthenticationClient(ApiConnection);
     Database       = new DatabaseClient(ApiConnection);
     Images         = new ImagesClient(ApiConnection);
     Marketplace    = new MarketplaceClient(ApiConnection);
     UserCollection = new UserCollectionClient(ApiConnection);
     UserIdentity   = new UserIdentityClient(ApiConnection);
     UserWantlist   = new UserWantlistClient(ApiConnection);
 }
Пример #3
0
        private void ListAvailableAddOns()
        {
            StoreClient       = StoreClient ?? new StoreClient(CurrentSubscription);
            MarketplaceClient = MarketplaceClient ??
                                new MarketplaceClient(StoreClient.GetLocations().Select(l => l.Name));

            WriteVerbose(Resources.GetAllAddOnsWaitMessage);
            List <WindowsAzureOffer> result         = MarketplaceClient.GetAvailableWindowsAzureOffers(Country);
            List <WindowsAzureOffer> knownProviders = result.Where <WindowsAzureOffer>(
                o => MarketplaceClient.IsKnownProvider(o.ProviderId)).ToList <WindowsAzureOffer>();

            WriteObject(knownProviders, true);
        }