public override async Task <ArmResponse <ArmResource> > GetAsync(CancellationToken cancellationToken = default) { return(new PhArmResponse <ArmResource, GenericResource>( await Operations.GetByIdAsync(Id, _apiVersion, cancellationToken), v => { Resource = new ArmResourceData(v); return new ArmResource(ClientOptions, Resource as ArmResourceData); })); }
public override ArmResponse <ArmResource> Get() { return(new PhArmResponse <ArmResource, GenericResource>( Operations.GetById(Id, _apiVersion), v => { Resource = new ArmResourceData(v); return new ArmResource(ClientOptions, Resource as ArmResourceData); })); }
public ArmOperation <ArmResource> StartAddTag(string key, string value) { ArmResource resource = GetResource(); UpdateTags(key, value, resource.Data.Tags); return(new PhArmOperation <ArmResource, GenericResource>( Operations.StartUpdateById(Id, _apiVersion, resource.Data).WaitForCompletionAsync().ConfigureAwait(false).GetAwaiter().GetResult(), v => { Resource = new ArmResourceData(v); return new ArmResource(ClientOptions, Resource as ArmResourceData); })); }
public async Task <ArmOperation <ArmResource> > StartAddTagAsync(string key, string value, CancellationToken cancellationToken = default) { ArmResource resource = GetResource(); UpdateTags(key, value, resource.Data.Tags); var op = await Operations.StartUpdateByIdAsync(Id, _apiVersion, resource.Data, cancellationToken); return(new PhArmOperation <ArmResource, GenericResource>( await op.WaitForCompletionAsync(cancellationToken), v => { Resource = new ArmResourceData(v); return new ArmResource(ClientOptions, Resource as ArmResourceData); })); }
public ArmResponse <TOperations> CreateResource <TContainer, TOperations, TResource>(string name, TResource model, Location location = default) where TResource : TrackedResource where TOperations : ResourceOperationsBase <TOperations> where TContainer : ResourceContainerBase <TOperations, TResource> { var myResource = Resource as TrackedResource; if (myResource == null) { myResource = new ArmResourceData(Id); } if (location != null) { myResource = new ArmResourceData(Id, location); } TContainer container = Activator.CreateInstance(typeof(TContainer), ClientOptions, myResource) as TContainer; return(container.Create(name, model)); }
public ArmResourceOperations(AzureResourceManagerClientOptions options, ArmResourceData resource) : base(options, resource) { }