本文整理汇总了Golang中github.com/whitepages/terraform-provider-stingray/Godeps/_workspace/src/github.com/hashicorp/terraform/helper/schema.ResourceData.Set方法的典型用法代码示例。如果您正苦于以下问题:Golang ResourceData.Set方法的具体用法?Golang ResourceData.Set怎么用?Golang ResourceData.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/whitepages/terraform-provider-stingray/Godeps/_workspace/src/github.com/hashicorp/terraform/helper/schema.Res
的用法示例。
在下文中一共展示了ResourceData.Set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: resourceMonitorScriptRead
func resourceMonitorScriptRead(d *schema.ResourceData, meta interface{}) error {
c := meta.(*providerConfig).client
r, resp, err := c.GetMonitorScript(d.Get("name").(string))
if err != nil {
if resp != nil && resp.StatusCode == 404 {
// The resource doesn't exist anymore
d.SetId("")
return nil
}
return fmt.Errorf("Error reading resource: %s", err)
}
d.Set("content", hashString(string(r.Content)))
return nil
}
示例2: resourceRateRead
func resourceRateRead(d *schema.ResourceData, meta interface{}) error {
c := meta.(*providerConfig).client
r, resp, err := c.GetRate(d.Get("name").(string))
if err != nil {
if resp != nil && resp.StatusCode == 404 {
// The resource doesn't exist anymore
d.SetId("")
return nil
}
return fmt.Errorf("Error reading resource: %s", err)
}
d.Set("max_rate_per_minute", int(*r.Basic.MaxRatePerMinute))
d.Set("max_rate_per_second", int(*r.Basic.MaxRatePerSecond))
d.Set("note", string(*r.Basic.Note))
return nil
}
示例3: resourceSSLServerKeyRead
func resourceSSLServerKeyRead(d *schema.ResourceData, meta interface{}) error {
c := meta.(*providerConfig).client
r, resp, err := c.GetSSLServerKey(d.Get("name").(string))
if err != nil {
if resp != nil && resp.StatusCode == 404 {
// The resource doesn't exist anymore
d.SetId("")
return nil
}
return fmt.Errorf("Error reading resource: %s", err)
}
d.Set("note", string(*r.Basic.Note))
d.Set("private", string(*r.Basic.Private))
d.Set("public", string(*r.Basic.Public))
d.Set("request", string(*r.Basic.Request))
return nil
}
示例4: resourceServiceLevelMonitorRead
func resourceServiceLevelMonitorRead(d *schema.ResourceData, meta interface{}) error {
c := meta.(*providerConfig).client
r, resp, err := c.GetServiceLevelMonitor(d.Get("name").(string))
if err != nil {
if resp != nil && resp.StatusCode == 404 {
// The resource doesn't exist anymore
d.SetId("")
return nil
}
return fmt.Errorf("Error reading resource: %s", err)
}
d.Set("note", string(*r.Basic.Note))
d.Set("response_time", int(*r.Basic.ResponseTime))
d.Set("serious_threshold", int(*r.Basic.SeriousThreshold))
d.Set("warning_threshold", int(*r.Basic.WarningThreshold))
return nil
}
示例5: resourceVirtualServerRead
func resourceVirtualServerRead(d *schema.ResourceData, meta interface{}) error {
c := meta.(*providerConfig).client
r, resp, err := c.GetVirtualServer(d.Get("name").(string))
if err != nil {
if resp != nil && resp.StatusCode == 404 {
// The resource doesn't exist anymore
d.SetId("")
return nil
}
return fmt.Errorf("Error reading resource: %s", err)
}
d.Set("connection_errors_error_file", string(*r.ConnectionErrors.ErrorFile))
d.Set("connection_keepalive_timeout", int(*r.Connection.KeepaliveTimeout))
d.Set("connection_timeout", int(*r.Connection.Timeout))
d.Set("connect_timeout", int(*r.Basic.ConnectTimeout))
d.Set("enabled", bool(*r.Basic.Enabled))
d.Set("gzip_enabled", bool(*r.Gzip.Enabled))
d.Set("gzip_include_mime", []string(*r.Gzip.IncludeMIME))
d.Set("http_location_rewrite", string(*r.HTTP.LocationRewrite))
d.Set("listen_on_any", bool(*r.Basic.ListenOnAny))
d.Set("listen_on_traffic_ips", []string(*r.Basic.ListenOnTrafficIPs))
d.Set("log_enabled", bool(*r.Log.Enabled))
d.Set("log_filename", string(*r.Log.Filename))
d.Set("log_format", string(*r.Log.Format))
d.Set("log_server_connection_failures", bool(*r.Log.ServerConnectionFailures))
d.Set("note", string(*r.Basic.Note))
d.Set("pool", string(*r.Basic.Pool))
d.Set("port", int(*r.Basic.Port))
d.Set("protocol", string(*r.Basic.Protocol))
d.Set("recent_connections_save_all", bool(*r.RecentConnections.SaveAll))
d.Set("request_rules", []string(*r.Basic.RequestRules))
d.Set("response_rules", []string(*r.Basic.ResponseRules))
d.Set("ssl_add_http_headers", bool(*r.SSL.AddHTTPHeaders))
d.Set("ssl_decrypt", bool(*r.Basic.SSLDecrypt))
d.Set("ssl_server_cert_default", string(*r.SSL.ServerCertDefault))
d.Set("ssl_server_cert_host_mapping", flattenServerCertHostMappingTable(*r.SSL.ServerCertHostMapping))
d.Set("syslog_format", string(*r.Syslog.Format))
d.Set("web_cache_enabled", bool(*r.WebCache.Enabled))
d.Set("web_cache_max_time", int(*r.WebCache.MaxTime))
return nil
}
示例6: resourcePoolRead
func resourcePoolRead(d *schema.ResourceData, meta interface{}) error {
c := meta.(*providerConfig).client
r, resp, err := c.GetPool(d.Get("name").(string))
if err != nil {
if resp != nil && resp.StatusCode == 404 {
// The resource doesn't exist anymore
d.SetId("")
return nil
}
return fmt.Errorf("Error reading resource: %s", err)
}
d.Set("bandwidth_class", string(*r.Basic.BandwidthClass))
d.Set("connection_max_connect_time", int(*r.Connection.MaxConnectTime))
d.Set("connection_max_connections_per_node", int(*r.Connection.MaxConnectionsPerNode))
d.Set("connection_max_queue_size", int(*r.Connection.MaxQueueSize))
d.Set("connection_max_reply_time", int(*r.Connection.MaxReplyTime))
d.Set("connection_queue_timeout", int(*r.Connection.QueueTimeout))
d.Set("failure_pool", string(*r.Basic.FailurePool))
d.Set("load_balancing_algorithm", string(*r.LoadBalancing.Algorithm))
d.Set("load_balancing_priority_enabled", bool(*r.LoadBalancing.PriorityEnabled))
d.Set("load_balancing_priority_nodes", int(*r.LoadBalancing.PriorityNodes))
d.Set("max_connection_attempts", int(*r.Basic.MaxConnectionAttempts))
d.Set("max_idle_connections_pernode", int(*r.Basic.MaxIdleConnectionsPerNode))
d.Set("max_timed_out_connection_attempts", int(*r.Basic.MaxTimedOutConnectionAttempts))
d.Set("monitors", []string(*r.Basic.Monitors))
d.Set("node_close_with_rst", bool(*r.Basic.NodeCloseWithRST))
d.Set("node_connection_attempts", int(*r.Basic.NodeConnectionAttempts))
d.Set("nodes", nodesTableToNodes(*r.Basic.NodesTable))
d.Set("note", string(*r.Basic.Note))
d.Set("passive_monitoring", bool(*r.Basic.PassiveMonitoring))
d.Set("persistence_class", string(*r.Basic.PersistenceClass))
d.Set("tcp_nagle", bool(*r.TCP.Nagle))
d.Set("udp_accept_from", string(*r.UDP.AcceptFrom))
d.Set("udp_accept_from_mask_class", string(*r.UDP.AcceptFromMask))
d.Set("transparent", bool(*r.Basic.Transparent))
return nil
}
示例7: resourceTrafficIPGroupRead
func resourceTrafficIPGroupRead(d *schema.ResourceData, meta interface{}) error {
c := meta.(*providerConfig).client
r, resp, err := c.GetTrafficIPGroup(d.Get("name").(string))
if err != nil {
if resp != nil && resp.StatusCode == 404 {
// The resource doesn't exist anymore
d.SetId("")
return nil
}
return fmt.Errorf("Error reading resource: %s", err)
}
d.Set("enabled", bool(*r.Basic.Enabled))
d.Set("hash_source_port", bool(*r.Basic.HashSourcePort))
d.Set("ipaddresses", []string(*r.Basic.IPAddresses))
d.Set("keeptogether", bool(*r.Basic.KeepTogether))
d.Set("location", int(*r.Basic.Location))
d.Set("machines", []string(*r.Basic.Machines))
d.Set("mode", string(*r.Basic.Mode))
d.Set("multicast", string(*r.Basic.Multicast))
d.Set("note", string(*r.Basic.Note))
d.Set("rhi_ospfv2_metric_base", int(*r.Basic.RHIOSPFV2MetricBase))
d.Set("rhi_ospfv2_passive_metric_offset", int(*r.Basic.RHIOSPFV2PassiveMetricOffset))
d.Set("slaves", []string(*r.Basic.Slaves))
return nil
}
示例8: resourceMonitorRead
func resourceMonitorRead(d *schema.ResourceData, meta interface{}) error {
c := meta.(*providerConfig).client
r, resp, err := c.GetMonitor(d.Get("name").(string))
if err != nil {
if resp != nil && resp.StatusCode == 404 {
// The resource doesn't exist anymore
d.SetId("")
return nil
}
return fmt.Errorf("Error reading resource: %s", err)
}
d.Set("back_off", bool(*r.Basic.BackOff))
d.Set("delay", int(*r.Basic.Delay))
d.Set("failures", int(*r.Basic.Failures))
d.Set("http_authentication", string(*r.HTTP.Authentication))
d.Set("http_body_regex", string(*r.HTTP.BodyRegex))
d.Set("http_host_header", string(*r.HTTP.HostHeader))
d.Set("http_path", string(*r.HTTP.Path))
d.Set("http_status_regex", string(*r.HTTP.StatusRegex))
d.Set("machine", string(*r.Basic.Machine))
d.Set("note", string(*r.Basic.Note))
d.Set("rtsp_body_regex", string(*r.RTSP.BodyRegex))
d.Set("rtsp_path", string(*r.RTSP.Path))
d.Set("rtsp_status_regex", string(*r.RTSP.StatusRegex))
d.Set("scope", string(*r.Basic.Scope))
d.Set("script_arguments", flattenScriptArgumentsTable(*r.Script.Arguments))
d.Set("script_program", string(*r.Script.Program))
d.Set("sip_body_regex", string(*r.SIP.BodyRegex))
d.Set("sip_status_regex", string(*r.SIP.StatusRegex))
d.Set("sip_transport", string(*r.SIP.Transport))
d.Set("tcp_close_string", string(*r.TCP.CloseString))
d.Set("tcp_max_response_len", int(*r.TCP.MaxResponseLen))
d.Set("tcp_response_regex", string(*r.TCP.ResponseRegex))
d.Set("tcp_write_string", string(*r.TCP.WriteString))
d.Set("timeout", int(*r.Basic.Timeout))
d.Set("type", string(*r.Basic.Type))
d.Set("udp_accept_all", bool(*r.UDP.AcceptAll))
d.Set("use_ssl", bool(*r.Basic.UseSSL))
d.Set("verbose", bool(*r.Basic.Verbose))
return nil
}