コード例 #1
0
        public static string CreateDefaultLocationBasedServicesAccount(Microsoft.Azure.Management.LocationBasedServices.Client locationBasedServicesManagementClient, string rgname)
        {
            string accountName = TestUtilities.GenerateName("lbs");
            LocationBasedServicesAccountCreateParameters parameters = GetDefaultLocationBasedServicesAccountParameters();
            var newAccount = locationBasedServicesManagementClient.Accounts.CreateOrUpdate(rgname, accountName, parameters);

            VerifyAccountProperties(newAccount, true);

            return(accountName);
        }
コード例 #2
0
        public static LocationBasedServicesAccountCreateParameters GetDefaultLocationBasedServicesAccountParameters()
        {
            LocationBasedServicesAccountCreateParameters account = new LocationBasedServicesAccountCreateParameters
            {
                Location = DefaultLocation,
                Tags     = DefaultTags,
                Sku      = new Microsoft.Azure.Management.LocationBasedServices.Models.Sku()
                {
                    Name = DefaultSkuName
                }
            };

            return(account);
        }
コード例 #3
0
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            RunCmdLet(() =>
            {
                LocationBasedServicesAccountCreateParameters createParameters = new LocationBasedServicesAccountCreateParameters()
                {
                    Sku      = new Sku(this.SkuName),
                    Tags     = TagsConversionHelper.CreateTagDictionary(Tag),
                    Location = "global"
                };

                if (ShouldProcess(
                        this.Name, string.Format(CultureInfo.CurrentCulture, Resources.NewAccount_ProcessMessage, this.Name, this.SkuName)))
                {
                    if (Force.IsPresent)
                    {
                        WriteWarning(Resources.NewAccount_Notice);
                    }
                    else
                    {
                        bool yesToAll = false, noToAll = false;
                        if (!ShouldContinue(Resources.NewAccount_Notice, "Notice", true, ref yesToAll, ref noToAll))
                        {
                            return;
                        }
                    }

                    var createAccountResponse = this.LocationBasedServicesClient.Accounts.CreateOrUpdate(
                        this.ResourceGroupName,
                        this.Name,
                        createParameters);

                    var locationBasedServicesAccount = this.LocationBasedServicesClient.Accounts.Get(this.ResourceGroupName, this.Name);

                    this.WriteLocationBasedServicesAccount(locationBasedServicesAccount);
                }
            });
        }
コード例 #4
0
 /// <summary>
 /// Create or update a Location Based Services Account. A Location Based
 /// Services Account holds the keys which allow access to the Location Based
 /// Services REST APIs.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the Azure Resource Group.
 /// </param>
 /// <param name='accountName'>
 /// The name of the Location Based Services Account.
 /// </param>
 /// <param name='locationBasedServicesAccountCreateParameters'>
 /// The new or updated parameters for the Location Based Services Account.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <LocationBasedServicesAccount> CreateOrUpdateAsync(this IAccountsOperations operations, string resourceGroupName, string accountName, LocationBasedServicesAccountCreateParameters locationBasedServicesAccountCreateParameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, locationBasedServicesAccountCreateParameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #5
0
 /// <summary>
 /// Create or update a Location Based Services Account. A Location Based
 /// Services Account holds the keys which allow access to the Location Based
 /// Services REST APIs.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the Azure Resource Group.
 /// </param>
 /// <param name='accountName'>
 /// The name of the Location Based Services Account.
 /// </param>
 /// <param name='locationBasedServicesAccountCreateParameters'>
 /// The new or updated parameters for the Location Based Services Account.
 /// </param>
 public static LocationBasedServicesAccount CreateOrUpdate(this IAccountsOperations operations, string resourceGroupName, string accountName, LocationBasedServicesAccountCreateParameters locationBasedServicesAccountCreateParameters)
 {
     return(operations.CreateOrUpdateAsync(resourceGroupName, accountName, locationBasedServicesAccountCreateParameters).GetAwaiter().GetResult());
 }