github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/mrs/v2/clusters/requests.go (about)

     1  package clusters
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	"github.com/huaweicloud/golangsdk/openstack/common/tags"
     6  )
     7  
     8  // CreateOpts is a structure representing information of the cluster creation.
     9  type CreateOpts struct {
    10  	// Region of the cluster.
    11  	Region string `json:"region" required:"true"`
    12  	// Availability zone name.
    13  	AvailabilityZone string `json:"availability_zone" required:"true"`
    14  	// Cluster name, which can contain 2 to 64 characters.
    15  	// Only letters, digits, hyphens (-), and underscores (_) are allowed.
    16  	ClusterName string `json:"cluster_name" required:"true"`
    17  	// Cluster type. The options are as follows:
    18  	//   ANALYSIS: analysis cluster
    19  	//   STREAMING: streaming cluster
    20  	//   MIXED: hybrid cluster
    21  	//   CUSTOM: customized cluster, which is supported only by MRS 3.x.
    22  	ClusterType string `json:"cluster_type" required:"true"`
    23  	// Cluster version.
    24  	// Possible values are as follows:
    25  	//   MRS 1.8.10
    26  	//   MRS 1.9.2
    27  	//   MRS 2.1.0
    28  	//   MRS 3.0.2
    29  	ClusterVersion string `json:"cluster_version" required:"true"`
    30  	// Name of the VPC where the subnet locates
    31  	// Perform the following operations to obtain the VPC name from the VPC management console:
    32  	// Log in to the management console.
    33  	// Click Virtual Private Cloud and select Virtual Private Cloud from the left list.
    34  	// On the Virtual Private Cloud page, obtain the VPC name from the list.
    35  	VpcName string `json:"vpc_name" required:"true"`
    36  	// List of component names, which are separated by commas (,). The options are as follows:
    37  	// MRS 3.0.5
    38  	//   ANALYSIS: Hadoop,Spark2x,HBase,Hive,Hue,Loader,Flink,Oozie,ZooKeeper,Ranger,Tez,Impala,Presto,Kudu,Alluxio
    39  	//   STREAMING: Kafka,Storm,Flume,ZooKeeper,Ranger
    40  	//   MIXED: Hadoop,Spark2x,HBase,Hive,Hue,Loader,Flink,Oozie,ZooKeeper,Ranger,Tez,Impala,Presto,Kudu,Alluxio,
    41  	//     Kafka,Storm,Flume
    42  	//   CUSTOM: Hadoop,Spark2x,HBase,Hive,Hue,Loader,Kafka,Storm,Flume,Flink,Oozie,ZooKeeper,Ranger,Tez,Impala,
    43  	//     Presto,ClickHouse,Kudu,Alluxio
    44  	// MRS 1.9.2
    45  	//   ANALYSIS: Presto,Hadoop,Spark,HBase,Opentsdb,Hive,Hue,Loader,Tez,Flink,Alluxio,Ranger
    46  	//   STREAMING: Kafka,KafkaManager,Storm,Flume
    47  	Components string `json:"components" required:"true"`
    48  	// Node login mode.
    49  	// PASSWORD: password-based login. If this value is selected, node_root_password cannot be left blank.
    50  	// KEYPAIR: specifies the key pair used for login. If this value is selected, node_keypair_name cannot be left blank.
    51  	LoginMode string `json:"login_mode" required:"true"`
    52  	// Password of the MRS Manager administrator.
    53  	// The password can contain 8 to 26 charactors.
    54  	// The password must contain lowercase letters, uppercase letters, digits, spaces
    55  	// and the special characters: !?,.:-_{}[]@$^+=/.
    56  	// the password cannot be the username or the username spelled backwards.
    57  	ManagerAdminPassword string `json:"manager_admin_password" required:"true"`
    58  	// Information about the node groups in the cluster. For details about the parameters, see Table 5.
    59  	NodeGroups []NodeGroupOpts `json:"node_groups" required:"true"`
    60  	// Running mode of an MRS cluster
    61  	// SIMPLE: normal cluster. In a normal cluster, Kerberos authentication is disabled, and users can use all functions provided by the cluster.
    62  	// KERBEROS: security cluster. In a security cluster, Kerberos authentication is enabled, and common users cannot use the file management and job management functions of an MRS cluster or view cluster resource usage and the job records of Hadoop and Spark. To use more cluster functions, the users must contact the Manager administrator to assign more permissions.
    63  	SafeMode string `json:"safe_mode" required:"true"`
    64  	// Jobs can be submitted when a cluster is created. Currently, only one job can be created. For details about job parameters, see Table 9.
    65  	AddJobs []JobOpts `json:"add_jobs,omitempty"`
    66  	// Whether to create the default security group of the MR S security group, the default is false.
    67  	// If true, no matter what 'security_groups_id' is set, the cluster will create a default security group.
    68  	AutoCreateSecGroup string `json:"auto_create_default_security_group,omitempty"`
    69  	// Bootstrap action script information. For more parameter description, see Table 8.
    70  	// MRS 1.7.2 or later supports this parameter.
    71  	BootstrapScripts []ScriptOpts `json:"bootstrap_scripts,omitempty"`
    72  	// Charging type information.
    73  	ChargeInfo *ChargeInfo `json:"charge_info,omitempty"`
    74  	// Indicates the enterprise project ID.
    75  	// When creating a cluster, associate the enterprise project ID with the cluster.
    76  	// The default value is 0, indicating the default enterprise project.
    77  	// To obtain the enterprise project ID, see the id value in the enterprise_project field data structure table in section Querying the Enterprise Project List of the Enterprise Management API Reference.
    78  	EnterpriseProjectId string `json:"enterprise_project_id,omitempty"`
    79  	// An EIP bound to an MRS cluster can be used to access MRS Manager. The EIP must have been created and must be in the same region as the cluster.
    80  	EipAddress string `json:"eip_address,omitempty"`
    81  	// ID of the bound EIP. This parameter is mandatory when eip_address is configured. To obtain the EIP ID, log in to the VPC console, choose Network > Elastic IP and Bandwidth > Elastic IP, click the EIP to be bound, and obtain the ID in the Basic Information area.
    82  	EipId string `json:"eip_id,omitempty"`
    83  	// Indicate whether it is a dedicated cloud resource, the default is false.
    84  	IsDecProject *bool `json:"is_dec_project,omitempty"`
    85  	// Specifies whether to collect logs when cluster creation fails:
    86  	//   0: Do not collect.
    87  	//   1: Collect.
    88  	// The default value is 1, indicating that OBS buckets will be created and only used to collect logs that record MRS cluster creation failures.
    89  	LogCollection *int `json:"log_collection,omitempty"`
    90  	// Name of the agency bound to a cluster node by default. The value is fixed to MRS_ECS_DEFAULT_AGENCY.
    91  	// An agency allows ECS or BMS to manage MRS resources. You can configure an agency of the ECS type to automatically obtain the AK/SK to access OBS.
    92  	// The MRS_ECS_DEFAULT_AGENCY agency has the OBS OperateAccess permission of OBS and the CES FullAccess (for users who have enabled fine-grained policies), CES Administrator, and KMS Administrator permissions in the region where the cluster is located.
    93  	MrsEcsDefaultAgency string `json:"mrs_ecs_default_agency,omitempty"`
    94  	// Password of user root for logging in to a cluster node.
    95  	// The password can contain 8 to 26 charactors.
    96  	// The password must contain lowercase letters, uppercase letters, digits, spaces
    97  	// and the special characters: !?,.:-_{}[]@$^+=/.
    98  	// the password cannot be the username or the username spelled backwards.
    99  	NodeRootPassword string `json:"node_root_password,omitempty"`
   100  	// Name of a key pair You can use a key pair to log in to the Master node in the cluster.
   101  	NodeKeypair string `json:"node_keypair_name,omitempty"`
   102  	// Security group ID of the cluster
   103  	// If this parameter is left blank, MRS automatically creates a security group, whose name starts with mrs_{cluster_name}.
   104  	// If this parameter is not left blank, a fixed security group is used to create a cluster. The transferred ID must be the security group ID owned by the current tenant. The security group must include an inbound rule in which all protocols and all ports are allowed and the source is the IP address of the specified node on the management plane.
   105  	SecurityGroupsIds string `json:"security_groups_id,omitempty"`
   106  	// Subnet ID.
   107  	SubnetId string `json:"subnet_id,omitempty"`
   108  	// Subnet name.
   109  	// Required if SubnetID is empty.
   110  	SubnetName string `json:"subnet_name,omitempty"`
   111  	// Specifies the template used for node deployment when the cluster type is CUSTOM.
   112  	// mgmt_control_combined_v2: template for jointly deploying the management and control nodes. The management and control roles are co-deployed on the Master node, and data instances are deployed in the same node group. This deployment mode applies to scenarios where the number of control nodes is less than 100, reducing costs.
   113  	// mgmt_control_separated_v2: The management and control roles are deployed on different master nodes, and data instances are deployed in the same node group. This deployment mode is applicable to a cluster with 100 to 500 nodes and delivers better performance in high-concurrency load scenarios.
   114  	// mgmt_control_data_separated_v2: The management role and control role are deployed on different Master nodes, and data instances are deployed in different node groups. This deployment mode is applicable to a cluster with more than 500 nodes. Components can be deployed separately, which can be used for a larger cluster scale.
   115  	TemplateId string `json:"template_id,omitempty"`
   116  	// Cluster tag For more parameter description, see Table 4.
   117  	// A maximum of 10 tags can be added to a cluster.
   118  	Tags []tags.ResourceTag `json:"tags,omitempty"`
   119  }
   120  
   121  // ChargeInfo is a structure representing billing information.
   122  type ChargeInfo struct {
   123  	// Billing mode.
   124  	// The valid values are as follows:
   125  	//   postPaid: indicates the pay-per-use billing mode.
   126  	ChargeMode string `json:"charge_mode" required:"true"`
   127  }
   128  
   129  // NodeGroupOpts is a structure representing node group.
   130  type NodeGroupOpts struct {
   131  	// Instance specifications of a node.
   132  	NodeSize string `json:"node_size" required:"true"`
   133  	// Specifies the node group name.
   134  	// The rules for configuring node groups are as follows:
   135  	//     master_node_default_group: Master node group, which must be included in all cluster types.
   136  	//     core_node_analysis_group: analysis Core node group, which must be contained in the analysis cluster and
   137  	//         hybrid cluster.
   138  	//     core_node_streaming_group: indicates the streaming Core node group, which must be included in both streaming
   139  	//         and hybrid clusters.
   140  	//     task_node_analysis_group: Analysis Task node group.
   141  	//         This node group can be selected for analysis clusters and hybrid clusters as required.
   142  	//     task_node_streaming_group: streaming Task node group.
   143  	//         This node group can be selected for streaming clusters and hybrid clusters as required.
   144  	//     node_group{x}: node group of the customized cluster. A maximum of nine node groups can be added.
   145  	//         The value can contain a maximum of 64 characters, including letters, digits and underscores (_).
   146  	GroupName string `json:"group_name" required:"true"`
   147  	// Number of nodes.
   148  	NodeNum int `json:"node_num" required:"true"`
   149  	// Specifies the system disk information of the node.
   150  	RootVolume *Volume `json:"root_volume,omitempty"`
   151  	// Data disk information.
   152  	DataVolume *Volume `json:"data_volume,omitempty"`
   153  	// Number of data disks of a node. The value range is 0 to 10.
   154  	DataVolumeCount *int `json:"data_volume_count,omitempty"`
   155  	// Billing type of the node group.
   156  	ChargeInfo *ChargeInfo `json:"charge_info,omitempty"`
   157  	// Autoscaling rule corresponding to the node group.
   158  	AsPolicy *AsPolicy `json:"auto_scaling_policy,omitempty"`
   159  	// This parameter is mandatory when the cluster type is CUSTOM. Specifies the roles deployed in a node group.
   160  	// This parameter is a character string array. Each character string represents a role expression.
   161  	// Role expression definition:
   162  	//     If the role is deployed on all nodes in the node group, set this parameter to <role name>, e.g. DataNode.
   163  	//     If the role is deployed on a specified subscript node in the node group:
   164  	//         <role name>:<index1>,<index2>..., <indexN>, e.g. NameNode:1,2.
   165  	//     Some roles support multi-instance deployment (that is, multiple instances of the same role are deployed on a
   166  	//         node): <role name>[<instance count>], for example, EsNode[9].
   167  	AssignedRoles []string `json:"assigned_roles,omitempty"`
   168  }
   169  
   170  // Volume is a structure representing node volume configurations.
   171  type Volume struct {
   172  	// Disk Type. The following disk types are supported:
   173  	//     SATA: common I/O disk
   174  	//     SAS: high I/O disk
   175  	//     SSD: ultra-high I/O disk
   176  	Type string `json:"type" required:"true"`
   177  	// Specifies the data disk size, in GB. The value range is 10 to 32768.
   178  	Size int `json:"size" required:"true"`
   179  }
   180  
   181  // AsPolicy is a structure representing auto-scaling policy for task nodes.
   182  type AsPolicy struct {
   183  	// Whether to enable the auto scaling rule.
   184  	Enabled string `json:"auto_scaling_enable" required:"true"`
   185  	// Minimum number of nodes left in the node group. The value range is 0 to 500.
   186  	MinCapacity int `json:"min_capacity" required:"true"`
   187  	// Maximum number of nodes in the node group. The value range is 0 to 500.
   188  	MaxCapacity int `json:"max_capacity" required:"true"`
   189  	// List of the resource plan.
   190  	ResourcesPlans []ResourcesPlan `json:"resources_plans,omitempty"`
   191  	// List of custom scaling automation scripts.
   192  	Rules []Rule `json:"rules,omitempty"`
   193  	// List of auto scaling rules.
   194  	ExecScripts []ScaleScript `json:"exec_scripts,omitempty"`
   195  }
   196  
   197  // ResourcesPlan is a structure representing resource plan of the policy.
   198  type ResourcesPlan struct {
   199  	// Cycle type of a resource plan.
   200  	PeriodType string `json:"period_type" required:"true"`
   201  	// Start time of a resource plan.
   202  	// The value is in the format of hour:minute, indicating that the time ranges from 0:00 to 23:59.
   203  	StartTime string `json:"start_time" required:"true"`
   204  	// End time of a resource plan. The value is in the same format as that of start_time.
   205  	// The interval between end_time and start_time must be greater than or equal to 30 minutes.
   206  	EndTime string `json:"end_time" required:"true"`
   207  	// Minimum number of the preserved nodes in a node group in a resource plan. The value range is 0 to 500.
   208  	MinCapacity int `json:"min_capacity" required:"true"`
   209  	// Maximum number of the preserved nodes in a node group in a resource plan. The value range is 0 to 500.
   210  	MaxCapacity int `json:"max_capacity" required:"true"`
   211  }
   212  
   213  // Rule is a structure representing configuration of the auto-scaling rule.
   214  type Rule struct {
   215  	// Auto scaling rule adjustment type. The options are scale_out and scale_in.
   216  	AdjustmentType string `json:"adjustment_type" required:"true"`
   217  	// Cluster cooling time after an auto scaling rule is triggered, when no auto scaling operation is performed.
   218  	// The unit is minute.
   219  	CoolDownMinutes int `json:"cool_down_minutes" required:"true"`
   220  	// Unique name of an auto scaling rule. A cluster name can contain only 1 to 64 characters.
   221  	// Only letters, digits, hyphens (-), and underscores (_) are allowed.
   222  	Name string `json:"name" required:"true"`
   223  	// Number of nodes that can be adjusted once. The value range is 1 to 100.
   224  	ScalingAdjustment int `json:"scaling_adjustment" required:"true"`
   225  	// Condition for triggering a rule.
   226  	Trigger Trigger `json:"trigger" required:"true"`
   227  	// Description about an auto scaling rule. It contains a maximum of 1,024 characters.
   228  	Description *string `json:"description,omitempty"`
   229  }
   230  
   231  // Trigger is a structure representing the condition for the triggering a rule.
   232  type Trigger struct {
   233  	// Number of consecutive five-minute periods, during which a metric threshold is reached.
   234  	// The value range is 1 to 288.
   235  	EvaluationPeriods int `json:"evaluation_periods" required:"true"`
   236  	// Metric name.
   237  	MetricName string `json:"metric_name" required:"true"`
   238  	// Metric threshold to trigger a rule.
   239  	MetricValue string `json:"metric_value" required:"true"`
   240  	// Metric judgment logic operator. The options are LT, GT, LTOE and GTOE.
   241  	ComparisonOperator string `json:"comparison_operator,omitempty"`
   242  }
   243  
   244  // ScriptOpts is a structure representing the bootstrap action script information.
   245  type ScriptOpts struct {
   246  	// Whether to continue executing subsequent scripts and creating a cluster after the bootstrap action script fails to be executed.
   247  	// continue: Continue to execute subsequent scripts.
   248  	// errorout: Stop the action.
   249  	// The default value is errorout, indicating that the action is stopped.
   250  	// NOTE:
   251  	// You are advised to set this parameter to continue in the commissioning phase so that the cluster can continue to be installed and started no matter whether the bootstrap action is successful.
   252  	FailAction string `json:"fail_action" required:"true"`
   253  	// Name of a bootstrap action script. It must be unique in a cluster.
   254  	// The value can contain only digits, letters, spaces, hyphens (-), and underscores (_) and must not start with a space.
   255  	// The value can contain 1 to 64 characters.
   256  	Name string `json:"name" required:"true"`
   257  	// Type of a node where the bootstrap action script is executed. The value can be Master, Core, or Task.
   258  	Nodes []string `json:"nodes" required:"true"`
   259  	// Bootstrap action script parameters.
   260  	Parameters string `json:"parameters,omitempty"`
   261  	// Path of a bootstrap action script. Set this parameter to an OBS bucket path or a local VM path.
   262  	// OBS bucket path: Enter a script path manually. For example, enter the path of the public sample script provided by MRS. Example: s3a://bootstrap/presto/presto-install.sh. If dualroles is installed, the parameter of the presto-install.sh script is dualroles. If worker is installed, the parameter of the presto-install.sh script is worker. Based on the Presto usage habit, you are advised to install dualroles on the active Master nodes and worker on the Core nodes.
   263  	// Local VM path: Enter a script path. The script path must start with a slash (/) and end with .sh.
   264  	URI string `json:"uri" required:"true"`
   265  	// Whether the bootstrap action script runs only on active Master nodes.
   266  	// The default value is false, indicating that the bootstrap action script can run on all Master nodes.
   267  	ActiveMaster *bool `json:"active_master,omitempty"`
   268  	// Time when the bootstrap action script is executed. Currently, the following two options are available: Before component start and After component start
   269  	// The default value is false, indicating that the bootstrap action script is executed after the component is started.
   270  	BeforeComponentStart *bool `json:"before_component_start,omitempty"`
   271  }
   272  
   273  // JobOpts is a structure representing the job which to execution.
   274  type JobOpts struct {
   275  	// SQL program path. This parameter is needed by Spark Script and Hive Script jobs only, and must meet the following requirements:
   276  	// Contains a maximum of 1,023 characters, excluding special characters such as ;|&><'$. The address cannot be empty or full of spaces.
   277  	// Files can be stored in HDFS or OBS. The path varies depending on the file system.
   278  	// OBS: The path must start with s3a://. Files or programs encrypted by KMS are not supported.
   279  	// HDFS: The path starts with a slash (/).
   280  	// Ends with .sql. sql is case-insensitive.
   281  	HiveScriptPath string `json:"hive_script_path" required:"true"`
   282  	// Job name. It contains 1 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.
   283  	// NOTE:
   284  	// Identical job names are allowed but not recommended.
   285  	JobName string `json:"job_name" required:"true"`
   286  	// Job type code
   287  	//   1: MapReduce
   288  	//   2: Spark
   289  	//   3: Hive Script
   290  	//   4: HiveQL (not supported currently)
   291  	//   5: DistCp, importing and exporting data (not supported currently)
   292  	//   6: Spark Script
   293  	//   7: Spark SQL, submitting Spark SQL statements (not supported currently).
   294  	// NOTE:
   295  	// Spark and Hive jobs can be added to only clusters that include Spark and Hive components.
   296  	JobType int `json:"job_type" required:"true"`
   297  	// true: Submit a job during cluster creation.
   298  	// false: Submit a job after the cluster is created.
   299  	// Set this parameter to true in this example.
   300  	SubmitJobOnceClusterRun bool `json:"submit_job_once_cluster_run" required:"true"`
   301  	// Key parameter for program execution. The parameter is specified by the function of the user's program. MRS is only responsible for loading the parameter.
   302  	// The parameter contains a maximum of 2,047 characters, excluding special characters such as ;|&>'<$, and can be left blank.
   303  	Arguments string `json:"arguments,omitempty"`
   304  	// Data import and export
   305  	// import
   306  	// export
   307  	FileAction string `json:"file_action,omitempty"`
   308  	// HiveQL statement
   309  	Hql string `json:"hql,omitempty"`
   310  	// Address for inputting data
   311  	// Files can be stored in HDFS or OBS. The path varies depending on the file system.
   312  	//   OBS: The path must start with s3a://. Files or programs encrypted by KMS are not supported.
   313  	//   HDFS: The path starts with a slash (/).
   314  	// The parameter contains a maximum of 1,023 characters, excluding special characters such as ;|&>'<$, and can be left blank.
   315  	Input string `json:"input,omitempty"`
   316  	// Path of the JAR or SQL file for program execution. The parameter must meet the following requirements:
   317  	// Contains a maximum of 1,023 characters, excluding special characters such as ;|&><'$. The parameter value cannot be empty or full of spaces.
   318  	// Files can be stored in HDFS or OBS. The path varies depending on the file system.
   319  	//   OBS: The path must start with s3a://. Files or programs encrypted by KMS are not supported.
   320  	//   HDFS: The path starts with a slash (/).
   321  	// Spark Script must end with .sql while MapReduce and Spark Jar must end with .jar. sql and jar are case-insensitive.
   322  	JarPath string `json:"jar_path,omitempty"`
   323  	// Path for storing job logs that record job running status.
   324  	// Files can be stored in HDFS or OBS. The path varies depending on the file system.
   325  	//   OBS: The path must start with s3a://.
   326  	//   HDFS: The path starts with a slash (/).
   327  	// The parameter contains a maximum of 1,023 characters, excluding special characters such as ;|&>'<$, and can be left blank.
   328  	JobLog string `json:"job_log,omitempty"`
   329  	// Address for outputting data
   330  	// Files can be stored in HDFS or OBS. The path varies depending on the file system.
   331  	//   OBS: The path must start with s3a://.
   332  	//   HDFS: The path starts with a slash (/).
   333  	// If the specified path does not exist, the system will automatically create it.
   334  	// The parameter contains a maximum of 1,023 characters, excluding special characters such as ;|&>'<$, and can be left blank.
   335  	Output string `json:"output,omitempty"`
   336  	// Whether to delete the cluster after the job execution is complete.
   337  	ShutdownCluster bool `json:"shutdown_cluster,omitempty"`
   338  }
   339  
   340  // ScaleScript is a structure representing the auto-scaling rules.
   341  type ScaleScript struct {
   342  	// Unique name of a custom automation script. The value can contain 1 to 64 characters.
   343  	// The value can contain digits, letters, spaces, hyphens (-), and underscores (_) and must not start with a space.
   344  	Name string `json:"name" required:"true"`
   345  	// Path of a custom automation script. Set this parameter to an OBS bucket path or a local VM path.
   346  	//     OBS bucket path: Enter a script path manually. for example, s3a://XXX/scale.sh.
   347  	//     Local VM path: Enter a script path. The script path must start with a slash (/) and end with .sh.
   348  	URI string `json:"uri" required:"true"`
   349  	// Type of a node where the custom automation script is executed. The node type can be Master, Core, or Task.
   350  	Nodes []string `json:"nodes" required:"true"`
   351  	// Time when a script is executed. The following four options are supported:
   352  	//     before_scale_out: before scale-out
   353  	//     before_scale_in: before scale-in
   354  	//     after_scale_out: after scale-out
   355  	//     after_scale_in: after scale-in
   356  	ActionStage string `json:"action_stage" required:"true"`
   357  	// Whether to continue to execute subsequent scripts and create a cluster after the custom automation script fails
   358  	// to be executed.
   359  	//     continue: Continue to execute subsequent scripts.
   360  	//     errorout: Stop the action.
   361  	FailAction string `json:"fail_action" required:"true"`
   362  	// Parameters of a custom automation script. Multiple parameters are separated by space.
   363  	// The following predefined system parameters can be transferred:
   364  	//     ${mrs_scale_node_num}: Number of the nodes to be added or removed.
   365  	//     ${mrs_scale_type}: Scaling type. The value can be scale_out or scale_in.
   366  	//     ${mrs_scale_node_hostnames}: Host names of the nodes to be added or removed.
   367  	//     ${mrs_scale_node_ips}: IP addresses of the nodes to be added or removed.
   368  	//     ${mrs_scale_rule_name}: Name of the rule that triggers auto scaling.
   369  	// Other user-defined parameters are used in the same way as those of common shell scripts.
   370  	Parameters string `json:"parameters,omitempty"`
   371  	// Whether the custom automation script runs only on the active Master node.
   372  	ActiveMaster bool `json:"active_master,omitempty"`
   373  }
   374  
   375  // CreateOptsBuilder is an interface which to support request body build of the cluster creation.
   376  type CreateOptsBuilder interface {
   377  	ToClusterCreateMap() (map[string]interface{}, error)
   378  }
   379  
   380  // ToClusterCreateMap is a method which to build a request body by the CreateOpts.
   381  func (opts CreateOpts) ToClusterCreateMap() (map[string]interface{}, error) {
   382  	return golangsdk.BuildRequestBody(opts, "")
   383  }
   384  
   385  // Create is a method to create a new mapreduce cluster.
   386  func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
   387  	b, err := opts.ToClusterCreateMap()
   388  	if err != nil {
   389  		r.Err = err
   390  		return
   391  	}
   392  
   393  	reqOpt := &golangsdk.RequestOpts{OkCodes: []int{200}}
   394  	_, r.Err = client.Post(rootURL(client), b, &r.Body, reqOpt)
   395  	return
   396  }