Microsoft.Azure.Commands.DataFactories.DataFactoryCommonUtilities.IsSucceededProvisioningState C# (CSharp) Method

IsSucceededProvisioningState() public static method

public static IsSucceededProvisioningState ( string provisioningState ) : bool
provisioningState string
return bool
        public static bool IsSucceededProvisioningState(string provisioningState)
        {
            return
                string.Compare(provisioningState, OperationStatus.Succeeded.ToString(),
                    StringComparison.OrdinalIgnoreCase) == 0;
        }

Usage Example

コード例 #1
0
        public virtual PSTable CreatePSTable(CreatePSTableParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            PSTable table       = null;
            Action  createTable = () =>
            {
                table =
                    new PSTable(CreateOrUpdateTable(
                                    parameters.ResourceGroupName,
                                    parameters.DataFactoryName,
                                    parameters.Name,
                                    parameters.RawJsonContent))
                {
                    ResourceGroupName = parameters.ResourceGroupName,
                    DataFactoryName   = parameters.DataFactoryName
                };

                if (!DataFactoryCommonUtilities.IsSucceededProvisioningState(table.ProvisioningState))
                {
                    string errorMessage = table.Properties == null
                        ? string.Empty
                        : table.Properties.ErrorMessage;
                    throw new ProvisioningFailedException(errorMessage);
                }
            };

            if (parameters.Force)
            {
                // If user decides to overwrite anyway, then there is no need to check if the table exists or not.
                createTable();
            }
            else
            {
                bool tableExists = CheckTableExists(parameters.ResourceGroupName, parameters.DataFactoryName,
                                                    parameters.Name);

                parameters.ConfirmAction(
                    !tableExists,  // prompt only if the table exists
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.TableExists,
                        parameters.Name,
                        parameters.DataFactoryName),
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.TableCreating,
                        parameters.Name,
                        parameters.DataFactoryName),
                    parameters.Name,
                    createTable);
            }

            return(table);
        }
All Usage Examples Of Microsoft.Azure.Commands.DataFactories.DataFactoryCommonUtilities::IsSucceededProvisioningState