Exemplo n.º 1
0
        /// <summary>
        /// Collects subscription ids from the pipeline.
        /// </summary>
        protected override void OnProcessRecord()
        {
            base.OnProcessRecord();
            this.DefaultApiVersion = string.IsNullOrWhiteSpace(this.ApiVersion) ? Constants.ResourcesApiVersion : this.ApiVersion;
            var resourceId = string.Empty;

            if (ShouldConstructResourceId(out resourceId))
            {
                ResourceId = resourceId;
            }

            if (!string.IsNullOrEmpty(ResourceId) && IsValidResourceId(ResourceId))
            {
                var resource = ResourceManagerSdkClient.GetById(ResourceId, DefaultApiVersion);
                WriteObject(resource);
            }
            else if (this.IsParameterBound(c => c.ApiVersion) || this.IsParameterBound(c => c.ExpandProperties) || !string.IsNullOrEmpty(ResourceId))
            {
                this.RunCmdlet();
            }
            else
            {
                this.RunSimpleCmdlet();
            }
        }