PacketCaptureResource IOperationSource <PacketCaptureResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = PacketCaptureData.DeserializePacketCaptureData(document.RootElement);

            return(new PacketCaptureResource(_client, data));
        }
        public async Task <Response <PacketCaptureData> > GetAsync(string subscriptionId, string resourceGroupName, string networkWatcherName, string packetCaptureName, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (networkWatcherName == null)
            {
                throw new ArgumentNullException(nameof(networkWatcherName));
            }
            if (packetCaptureName == null)
            {
                throw new ArgumentNullException(nameof(packetCaptureName));
            }

            using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkWatcherName, packetCaptureName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                PacketCaptureData value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = PacketCaptureData.DeserializePacketCaptureData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Beispiel #3
0
 internal PacketCapture(ArmResource options, PacketCaptureData resource) : base(options, new ResourceIdentifier(resource.Id))
 {
     HasData                   = true;
     _data                     = resource;
     _clientDiagnostics        = new ClientDiagnostics(ClientOptions);
     _packetCapturesRestClient = new PacketCapturesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
 }
Beispiel #4
0
 internal PacketCapture(ArmResource options, PacketCaptureData resource) : base(options, resource.Id)
 {
     HasData            = true;
     _data              = resource;
     _clientDiagnostics = new ClientDiagnostics(ClientOptions);
     _restClient        = new PacketCapturesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri);
 }
Beispiel #5
0
 internal PacketCapture(ArmClient client, PacketCaptureData data) : this(client, new ResourceIdentifier(data.Id))
 {
     HasData = true;
     _data   = data;
 }
Beispiel #6
0
 internal PacketCaptureResource(ArmClient client, PacketCaptureData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }