protected override void ProcessRecord() { base.ProcessRecord(); GetAttributeRequest request; try { request = new GetAttributeRequest { CatalogId = CatalogId, DataAssetKey = DataAssetKey, EntityKey = EntityKey, AttributeKey = AttributeKey, Fields = Fields, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public IActionResult GetAttribute([FromBody] GetAttributeRequest value) { var session = this.GetSession(value.Session, true); T2D.Entities.BaseThing thing = this.Find(value.ThingId) .Include(t => t.ThingAttributes) .FirstOrDefault() ; if (thing == null) { return(BadRequest($"Thing '{value.ThingId}' do not exists.")); } var role = this.RoleMapper.EnumToEntity(value.Role); var attribute = this.AttributeMapper.EnumToEntity(value.Attribute); GetAttributeResponse ret = new GetAttributeResponse { Attribute = attribute.Name, TimeStamp = DateTime.UtcNow, Value = GetPropertyValue(thing, attribute.Name) }; return(Ok(ret)); }
/// <summary> /// Creates a waiter using the provided configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="config">Wait Configuration</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetAttributeRequest, GetAttributeResponse> ForAttribute(GetAttributeRequest request, WaiterConfiguration config, params LifecycleState[] targetStates) { var agent = new WaiterAgent <GetAttributeRequest, GetAttributeResponse>( request, request => client.GetAttribute(request), response => targetStates.Contains(response.Attribute.LifecycleState.Value), targetStates.Contains(LifecycleState.Deleted) ); return(new Waiter <GetAttributeRequest, GetAttributeResponse>(config, agent)); }
private void HandleOutput(GetAttributeRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForAttribute(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetAttribute(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Attribute); }
// Start is called before the first frame update void Start() { getAttributeRequest = GetComponent <GetAttributeRequest>(); }
/// <summary> /// Creates a waiter using default wait configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetAttributeRequest, GetAttributeResponse> ForAttribute(GetAttributeRequest request, params LifecycleState[] targetStates) { return(this.ForAttribute(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }