예제 #1
0
        public virtual async Task <Response <IotCentralAppResource> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _iotCentralAppAppsClientDiagnostics.CreateScope("IotCentralAppResource.Get");
            scope.Start();
            try
            {
                var response = await _iotCentralAppAppsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new IotCentralAppResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
예제 #2
0
        public virtual async Task <Response <AppPlatformAppResource> > GetAsync(string appName, string syncStatus = null, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(appName, nameof(appName));

            using var scope = _appPlatformAppResourceAppsClientDiagnostics.CreateScope("AppPlatformAppResourceCollection.Get");
            scope.Start();
            try
            {
                var response = await _appPlatformAppResourceAppsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, appName, syncStatus, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new AppPlatformAppResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }