github.com/newrelic/newrelic-client-go@v1.1.0/pkg/synthetics/synthetics_api.go (about)

     1  // Code generated by tutone: DO NOT EDIT
     2  package synthetics
     3  
     4  import (
     5  	"context"
     6  
     7  	"github.com/newrelic/newrelic-client-go/pkg/errors"
     8  )
     9  
    10  // Create a Synthetic Broken Links monitor
    11  func (a *Synthetics) SyntheticsCreateBrokenLinksMonitor(
    12  	accountID int,
    13  	monitor SyntheticsCreateBrokenLinksMonitorInput,
    14  ) (*SyntheticsBrokenLinksMonitorCreateMutationResult, error) {
    15  	return a.SyntheticsCreateBrokenLinksMonitorWithContext(context.Background(),
    16  		accountID,
    17  		monitor,
    18  	)
    19  }
    20  
    21  // Create a Synthetic Broken Links monitor
    22  func (a *Synthetics) SyntheticsCreateBrokenLinksMonitorWithContext(
    23  	ctx context.Context,
    24  	accountID int,
    25  	monitor SyntheticsCreateBrokenLinksMonitorInput,
    26  ) (*SyntheticsBrokenLinksMonitorCreateMutationResult, error) {
    27  
    28  	resp := SyntheticsCreateBrokenLinksMonitorQueryResponse{}
    29  	vars := map[string]interface{}{
    30  		"accountId": accountID,
    31  		"monitor":   monitor,
    32  	}
    33  
    34  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsCreateBrokenLinksMonitorMutation, vars, &resp); err != nil {
    35  		return nil, err
    36  	}
    37  
    38  	return &resp.SyntheticsBrokenLinksMonitorCreateMutationResult, nil
    39  }
    40  
    41  type SyntheticsCreateBrokenLinksMonitorQueryResponse struct {
    42  	SyntheticsBrokenLinksMonitorCreateMutationResult SyntheticsBrokenLinksMonitorCreateMutationResult `json:"SyntheticsCreateBrokenLinksMonitor"`
    43  }
    44  
    45  const SyntheticsCreateBrokenLinksMonitorMutation = `mutation(
    46  	$accountId: Int!,
    47  	$monitor: SyntheticsCreateBrokenLinksMonitorInput!,
    48  ) { syntheticsCreateBrokenLinksMonitor(
    49  	accountId: $accountId,
    50  	monitor: $monitor,
    51  ) {
    52  	errors {
    53  		description
    54  		type
    55  	}
    56  	monitor {
    57  		createdAt
    58  		guid
    59  		id
    60  		locations {
    61  			private
    62  			public
    63  		}
    64  		modifiedAt
    65  		name
    66  		period
    67  		status
    68  		uri
    69  	}
    70  } }`
    71  
    72  // Create a Synthetic Cert Check (Certificate check) monitor
    73  func (a *Synthetics) SyntheticsCreateCertCheckMonitor(
    74  	accountID int,
    75  	monitor SyntheticsCreateCertCheckMonitorInput,
    76  ) (*SyntheticsCertCheckMonitorCreateMutationResult, error) {
    77  	return a.SyntheticsCreateCertCheckMonitorWithContext(context.Background(),
    78  		accountID,
    79  		monitor,
    80  	)
    81  }
    82  
    83  // Create a Synthetic Cert Check (Certificate check) monitor
    84  func (a *Synthetics) SyntheticsCreateCertCheckMonitorWithContext(
    85  	ctx context.Context,
    86  	accountID int,
    87  	monitor SyntheticsCreateCertCheckMonitorInput,
    88  ) (*SyntheticsCertCheckMonitorCreateMutationResult, error) {
    89  
    90  	resp := SyntheticsCreateCertCheckMonitorQueryResponse{}
    91  	vars := map[string]interface{}{
    92  		"accountId": accountID,
    93  		"monitor":   monitor,
    94  	}
    95  
    96  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsCreateCertCheckMonitorMutation, vars, &resp); err != nil {
    97  		return nil, err
    98  	}
    99  
   100  	return &resp.SyntheticsCertCheckMonitorCreateMutationResult, nil
   101  }
   102  
   103  type SyntheticsCreateCertCheckMonitorQueryResponse struct {
   104  	SyntheticsCertCheckMonitorCreateMutationResult SyntheticsCertCheckMonitorCreateMutationResult `json:"SyntheticsCreateCertCheckMonitor"`
   105  }
   106  
   107  const SyntheticsCreateCertCheckMonitorMutation = `mutation(
   108  	$accountId: Int!,
   109  	$monitor: SyntheticsCreateCertCheckMonitorInput!,
   110  ) { syntheticsCreateCertCheckMonitor(
   111  	accountId: $accountId,
   112  	monitor: $monitor,
   113  ) {
   114  	errors {
   115  		description
   116  		type
   117  	}
   118  	monitor {
   119  		createdAt
   120  		domain
   121  		guid
   122  		id
   123  		locations {
   124  			private
   125  			public
   126  		}
   127  		modifiedAt
   128  		name
   129  		numberDaysToFailBeforeCertExpires
   130  		period
   131  		status
   132  	}
   133  } }`
   134  
   135  // Create a Synthetics Private Location
   136  func (a *Synthetics) SyntheticsCreatePrivateLocation(
   137  	accountID int,
   138  	description string,
   139  	name string,
   140  	verifiedScriptExecution bool,
   141  ) (*SyntheticsPrivateLocationMutationResult, error) {
   142  	return a.SyntheticsCreatePrivateLocationWithContext(context.Background(),
   143  		accountID,
   144  		description,
   145  		name,
   146  		verifiedScriptExecution,
   147  	)
   148  }
   149  
   150  // Create a Synthetics Private Location
   151  func (a *Synthetics) SyntheticsCreatePrivateLocationWithContext(
   152  	ctx context.Context,
   153  	accountID int,
   154  	description string,
   155  	name string,
   156  	verifiedScriptExecution bool,
   157  ) (*SyntheticsPrivateLocationMutationResult, error) {
   158  
   159  	resp := SyntheticsCreatePrivateLocationQueryResponse{}
   160  	vars := map[string]interface{}{
   161  		"accountId":               accountID,
   162  		"description":             description,
   163  		"name":                    name,
   164  		"verifiedScriptExecution": verifiedScriptExecution,
   165  	}
   166  
   167  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsCreatePrivateLocationMutation, vars, &resp); err != nil {
   168  		return nil, err
   169  	}
   170  
   171  	return &resp.SyntheticsPrivateLocationMutationResult, nil
   172  }
   173  
   174  type SyntheticsCreatePrivateLocationQueryResponse struct {
   175  	SyntheticsPrivateLocationMutationResult SyntheticsPrivateLocationMutationResult `json:"SyntheticsCreatePrivateLocation"`
   176  }
   177  
   178  const SyntheticsCreatePrivateLocationMutation = `mutation(
   179  	$accountId: Int!,
   180  	$description: String,
   181  	$name: String!,
   182  	$verifiedScriptExecution: Boolean!,
   183  ) { syntheticsCreatePrivateLocation(
   184  	accountId: $accountId,
   185  	description: $description,
   186  	name: $name,
   187  	verifiedScriptExecution: $verifiedScriptExecution,
   188  ) {
   189  	accountId
   190  	description
   191  	domainId
   192  	errors {
   193  		description
   194  		type
   195  	}
   196  	guid
   197  	key
   198  	locationId
   199  	name
   200  	verifiedScriptExecution
   201  } }`
   202  
   203  // Create a Synthetic Script Api monitor
   204  func (a *Synthetics) SyntheticsCreateScriptAPIMonitor(
   205  	accountID int,
   206  	monitor SyntheticsCreateScriptAPIMonitorInput,
   207  ) (*SyntheticsScriptAPIMonitorCreateMutationResult, error) {
   208  	return a.SyntheticsCreateScriptAPIMonitorWithContext(context.Background(),
   209  		accountID,
   210  		monitor,
   211  	)
   212  }
   213  
   214  // Create a Synthetic Script Api monitor
   215  func (a *Synthetics) SyntheticsCreateScriptAPIMonitorWithContext(
   216  	ctx context.Context,
   217  	accountID int,
   218  	monitor SyntheticsCreateScriptAPIMonitorInput,
   219  ) (*SyntheticsScriptAPIMonitorCreateMutationResult, error) {
   220  
   221  	resp := SyntheticsCreateScriptAPIMonitorQueryResponse{}
   222  	vars := map[string]interface{}{
   223  		"accountId": accountID,
   224  		"monitor":   monitor,
   225  	}
   226  
   227  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsCreateScriptAPIMonitorMutation, vars, &resp); err != nil {
   228  		return nil, err
   229  	}
   230  
   231  	return &resp.SyntheticsScriptAPIMonitorCreateMutationResult, nil
   232  }
   233  
   234  type SyntheticsCreateScriptAPIMonitorQueryResponse struct {
   235  	SyntheticsScriptAPIMonitorCreateMutationResult SyntheticsScriptAPIMonitorCreateMutationResult `json:"SyntheticsCreateScriptAPIMonitor"`
   236  }
   237  
   238  const SyntheticsCreateScriptAPIMonitorMutation = `mutation(
   239  	$accountId: Int!,
   240  	$monitor: SyntheticsCreateScriptApiMonitorInput!,
   241  ) { syntheticsCreateScriptApiMonitor(
   242  	accountId: $accountId,
   243  	monitor: $monitor,
   244  ) {
   245  	errors {
   246  		description
   247  		type
   248  	}
   249  	monitor {
   250  		createdAt
   251  		guid
   252  		id
   253  		locations {
   254  			private
   255  			public
   256  		}
   257  		modifiedAt
   258  		name
   259  		period
   260  		runtime {
   261  			runtimeType
   262  			runtimeTypeVersion
   263  			scriptLanguage
   264  		}
   265  		status
   266  	}
   267  } }`
   268  
   269  // Create a Synthetic Script Browser Monitor
   270  func (a *Synthetics) SyntheticsCreateScriptBrowserMonitor(
   271  	accountID int,
   272  	monitor SyntheticsCreateScriptBrowserMonitorInput,
   273  ) (*SyntheticsScriptBrowserMonitorCreateMutationResult, error) {
   274  	return a.SyntheticsCreateScriptBrowserMonitorWithContext(context.Background(),
   275  		accountID,
   276  		monitor,
   277  	)
   278  }
   279  
   280  // Create a Synthetic Script Browser Monitor
   281  func (a *Synthetics) SyntheticsCreateScriptBrowserMonitorWithContext(
   282  	ctx context.Context,
   283  	accountID int,
   284  	monitor SyntheticsCreateScriptBrowserMonitorInput,
   285  ) (*SyntheticsScriptBrowserMonitorCreateMutationResult, error) {
   286  
   287  	resp := SyntheticsCreateScriptBrowserMonitorQueryResponse{}
   288  	vars := map[string]interface{}{
   289  		"accountId": accountID,
   290  		"monitor":   monitor,
   291  	}
   292  
   293  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsCreateScriptBrowserMonitorMutation, vars, &resp); err != nil {
   294  		return nil, err
   295  	}
   296  
   297  	return &resp.SyntheticsScriptBrowserMonitorCreateMutationResult, nil
   298  }
   299  
   300  type SyntheticsCreateScriptBrowserMonitorQueryResponse struct {
   301  	SyntheticsScriptBrowserMonitorCreateMutationResult SyntheticsScriptBrowserMonitorCreateMutationResult `json:"SyntheticsCreateScriptBrowserMonitor"`
   302  }
   303  
   304  const SyntheticsCreateScriptBrowserMonitorMutation = `mutation(
   305  	$accountId: Int!,
   306  	$monitor: SyntheticsCreateScriptBrowserMonitorInput!,
   307  ) { syntheticsCreateScriptBrowserMonitor(
   308  	accountId: $accountId,
   309  	monitor: $monitor,
   310  ) {
   311  	errors {
   312  		description
   313  		type
   314  	}
   315  	monitor {
   316  		advancedOptions {
   317  			enableScreenshotOnFailureAndScript
   318  		}
   319  		createdAt
   320  		guid
   321  		id
   322  		locations {
   323  			private
   324  			public
   325  		}
   326  		modifiedAt
   327  		name
   328  		period
   329  		runtime {
   330  			runtimeType
   331  			runtimeTypeVersion
   332  			scriptLanguage
   333  		}
   334  		status
   335  	}
   336  } }`
   337  
   338  // Queues a request to create a secure credential
   339  func (a *Synthetics) SyntheticsCreateSecureCredential(
   340  	accountID int,
   341  	description string,
   342  	key string,
   343  	value SecureValue,
   344  ) (*SyntheticsSecureCredentialMutationResult, error) {
   345  	return a.SyntheticsCreateSecureCredentialWithContext(context.Background(),
   346  		accountID,
   347  		description,
   348  		key,
   349  		value,
   350  	)
   351  }
   352  
   353  // Queues a request to create a secure credential
   354  func (a *Synthetics) SyntheticsCreateSecureCredentialWithContext(
   355  	ctx context.Context,
   356  	accountID int,
   357  	description string,
   358  	key string,
   359  	value SecureValue,
   360  ) (*SyntheticsSecureCredentialMutationResult, error) {
   361  
   362  	resp := SyntheticsCreateSecureCredentialQueryResponse{}
   363  	vars := map[string]interface{}{
   364  		"accountId":   accountID,
   365  		"description": description,
   366  		"key":         key,
   367  		"value":       value,
   368  	}
   369  
   370  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsCreateSecureCredentialMutation, vars, &resp); err != nil {
   371  		return nil, err
   372  	}
   373  
   374  	return &resp.SyntheticsSecureCredentialMutationResult, nil
   375  }
   376  
   377  type SyntheticsCreateSecureCredentialQueryResponse struct {
   378  	SyntheticsSecureCredentialMutationResult SyntheticsSecureCredentialMutationResult `json:"SyntheticsCreateSecureCredential"`
   379  }
   380  
   381  const SyntheticsCreateSecureCredentialMutation = `mutation(
   382  	$accountId: Int!,
   383  	$description: String,
   384  	$key: String!,
   385  	$value: SecureValue!,
   386  ) { syntheticsCreateSecureCredential(
   387  	accountId: $accountId,
   388  	description: $description,
   389  	key: $key,
   390  	value: $value,
   391  ) {
   392  	createdAt
   393  	description
   394  	errors {
   395  		description
   396  	}
   397  	key
   398  	lastUpdate
   399  } }`
   400  
   401  // Create a Synthetic Simple (Ping) monitor
   402  func (a *Synthetics) SyntheticsCreateSimpleBrowserMonitor(
   403  	accountID int,
   404  	monitor SyntheticsCreateSimpleBrowserMonitorInput,
   405  ) (*SyntheticsSimpleBrowserMonitorCreateMutationResult, error) {
   406  	return a.SyntheticsCreateSimpleBrowserMonitorWithContext(context.Background(),
   407  		accountID,
   408  		monitor,
   409  	)
   410  }
   411  
   412  // Create a Synthetic Simple (Ping) monitor
   413  func (a *Synthetics) SyntheticsCreateSimpleBrowserMonitorWithContext(
   414  	ctx context.Context,
   415  	accountID int,
   416  	monitor SyntheticsCreateSimpleBrowserMonitorInput,
   417  ) (*SyntheticsSimpleBrowserMonitorCreateMutationResult, error) {
   418  
   419  	resp := SyntheticsCreateSimpleBrowserMonitorQueryResponse{}
   420  	vars := map[string]interface{}{
   421  		"accountId": accountID,
   422  		"monitor":   monitor,
   423  	}
   424  
   425  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsCreateSimpleBrowserMonitorMutation, vars, &resp); err != nil {
   426  		return nil, err
   427  	}
   428  
   429  	return &resp.SyntheticsSimpleBrowserMonitorCreateMutationResult, nil
   430  }
   431  
   432  type SyntheticsCreateSimpleBrowserMonitorQueryResponse struct {
   433  	SyntheticsSimpleBrowserMonitorCreateMutationResult SyntheticsSimpleBrowserMonitorCreateMutationResult `json:"SyntheticsCreateSimpleBrowserMonitor"`
   434  }
   435  
   436  const SyntheticsCreateSimpleBrowserMonitorMutation = `mutation(
   437  	$accountId: Int!,
   438  	$monitor: SyntheticsCreateSimpleBrowserMonitorInput!,
   439  ) { syntheticsCreateSimpleBrowserMonitor(
   440  	accountId: $accountId,
   441  	monitor: $monitor,
   442  ) {
   443  	errors {
   444  		description
   445  		type
   446  	}
   447  	monitor {
   448  		advancedOptions {
   449  			enableScreenshotOnFailureAndScript
   450  			responseValidationText
   451  			useTlsValidation
   452  		}
   453  		createdAt
   454  		guid
   455  		id
   456  		locations {
   457  			private
   458  			public
   459  		}
   460  		modifiedAt
   461  		name
   462  		period
   463  		runtime {
   464  			runtimeType
   465  			runtimeTypeVersion
   466  			scriptLanguage
   467  		}
   468  		status
   469  		uri
   470  	}
   471  } }`
   472  
   473  // Create a Synthetic Simple (Ping) monitor
   474  func (a *Synthetics) SyntheticsCreateSimpleMonitor(
   475  	accountID int,
   476  	monitor SyntheticsCreateSimpleMonitorInput,
   477  ) (*SyntheticsSimpleBrowserMonitorCreateMutationResult, error) {
   478  	return a.SyntheticsCreateSimpleMonitorWithContext(context.Background(),
   479  		accountID,
   480  		monitor,
   481  	)
   482  }
   483  
   484  // Create a Synthetic Simple (Ping) monitor
   485  func (a *Synthetics) SyntheticsCreateSimpleMonitorWithContext(
   486  	ctx context.Context,
   487  	accountID int,
   488  	monitor SyntheticsCreateSimpleMonitorInput,
   489  ) (*SyntheticsSimpleBrowserMonitorCreateMutationResult, error) {
   490  
   491  	resp := SyntheticsCreateSimpleMonitorQueryResponse{}
   492  	vars := map[string]interface{}{
   493  		"accountId": accountID,
   494  		"monitor":   monitor,
   495  	}
   496  
   497  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsCreateSimpleMonitorMutation, vars, &resp); err != nil {
   498  		return nil, err
   499  	}
   500  
   501  	return &resp.SyntheticsSimpleBrowserMonitorCreateMutationResult, nil
   502  }
   503  
   504  type SyntheticsCreateSimpleMonitorQueryResponse struct {
   505  	SyntheticsSimpleBrowserMonitorCreateMutationResult SyntheticsSimpleBrowserMonitorCreateMutationResult `json:"SyntheticsCreateSimpleMonitor"`
   506  }
   507  
   508  const SyntheticsCreateSimpleMonitorMutation = `mutation(
   509  	$accountId: Int!,
   510  	$monitor: SyntheticsCreateSimpleMonitorInput!,
   511  ) { syntheticsCreateSimpleMonitor(
   512  	accountId: $accountId,
   513  	monitor: $monitor,
   514  ) {
   515  	errors {
   516  		description
   517  		type
   518  	}
   519  	monitor {
   520  		advancedOptions {
   521  			enableScreenshotOnFailureAndScript
   522  			responseValidationText
   523  			useTlsValidation
   524  		}
   525  		createdAt
   526  		guid
   527  		id
   528  		locations {
   529  			private
   530  			public
   531  		}
   532  		modifiedAt
   533  		name
   534  		period
   535  		runtime {
   536  			runtimeType
   537  			runtimeTypeVersion
   538  			scriptLanguage
   539  		}
   540  		status
   541  		uri
   542  	}
   543  } }`
   544  
   545  // Create a Synthetic Step monitor
   546  func (a *Synthetics) SyntheticsCreateStepMonitor(
   547  	accountID int,
   548  	monitor SyntheticsCreateStepMonitorInput,
   549  ) (*SyntheticsStepMonitorCreateMutationResult, error) {
   550  	return a.SyntheticsCreateStepMonitorWithContext(context.Background(),
   551  		accountID,
   552  		monitor,
   553  	)
   554  }
   555  
   556  // Create a Synthetic Step monitor
   557  func (a *Synthetics) SyntheticsCreateStepMonitorWithContext(
   558  	ctx context.Context,
   559  	accountID int,
   560  	monitor SyntheticsCreateStepMonitorInput,
   561  ) (*SyntheticsStepMonitorCreateMutationResult, error) {
   562  
   563  	resp := SyntheticsCreateStepMonitorQueryResponse{}
   564  	vars := map[string]interface{}{
   565  		"accountId": accountID,
   566  		"monitor":   monitor,
   567  	}
   568  
   569  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsCreateStepMonitorMutation, vars, &resp); err != nil {
   570  		return nil, err
   571  	}
   572  
   573  	return &resp.SyntheticsStepMonitorCreateMutationResult, nil
   574  }
   575  
   576  type SyntheticsCreateStepMonitorQueryResponse struct {
   577  	SyntheticsStepMonitorCreateMutationResult SyntheticsStepMonitorCreateMutationResult `json:"SyntheticsCreateStepMonitor"`
   578  }
   579  
   580  const SyntheticsCreateStepMonitorMutation = `mutation(
   581  	$accountId: Int!,
   582  	$monitor: SyntheticsCreateStepMonitorInput!,
   583  ) { syntheticsCreateStepMonitor(
   584  	accountId: $accountId,
   585  	monitor: $monitor,
   586  ) {
   587  	errors {
   588  		description
   589  		type
   590  	}
   591  	monitor {
   592  		advancedOptions {
   593  			enableScreenshotOnFailureAndScript
   594  		}
   595  		createdAt
   596  		guid
   597  		id
   598  		locations {
   599  			private
   600  			public
   601  		}
   602  		modifiedAt
   603  		name
   604  		period
   605  		status
   606  		steps {
   607  			ordinal
   608  			type
   609  			values
   610  		}
   611  	}
   612  } }`
   613  
   614  // Delete a Synthetic Monitor
   615  func (a *Synthetics) SyntheticsDeleteMonitor(
   616  	gUID EntityGUID,
   617  ) (*SyntheticsMonitorDeleteMutationResult, error) {
   618  	return a.SyntheticsDeleteMonitorWithContext(context.Background(),
   619  		gUID,
   620  	)
   621  }
   622  
   623  // Delete a Synthetic Monitor
   624  func (a *Synthetics) SyntheticsDeleteMonitorWithContext(
   625  	ctx context.Context,
   626  	gUID EntityGUID,
   627  ) (*SyntheticsMonitorDeleteMutationResult, error) {
   628  
   629  	resp := SyntheticsDeleteMonitorQueryResponse{}
   630  	vars := map[string]interface{}{
   631  		"guid": gUID,
   632  	}
   633  
   634  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsDeleteMonitorMutation, vars, &resp); err != nil {
   635  		return nil, err
   636  	}
   637  
   638  	return &resp.SyntheticsMonitorDeleteMutationResult, nil
   639  }
   640  
   641  type SyntheticsDeleteMonitorQueryResponse struct {
   642  	SyntheticsMonitorDeleteMutationResult SyntheticsMonitorDeleteMutationResult `json:"SyntheticsDeleteMonitor"`
   643  }
   644  
   645  const SyntheticsDeleteMonitorMutation = `mutation(
   646  	$guid: EntityGuid!,
   647  ) { syntheticsDeleteMonitor(
   648  	guid: $guid,
   649  ) {
   650  	deletedGuid
   651  } }`
   652  
   653  // Delete a Synthetics Private Location
   654  func (a *Synthetics) SyntheticsDeletePrivateLocation(
   655  	gUID EntityGUID,
   656  ) (*SyntheticsPrivateLocationDeleteResult, error) {
   657  	return a.SyntheticsDeletePrivateLocationWithContext(context.Background(),
   658  		gUID,
   659  	)
   660  }
   661  
   662  // Delete a Synthetics Private Location
   663  func (a *Synthetics) SyntheticsDeletePrivateLocationWithContext(
   664  	ctx context.Context,
   665  	gUID EntityGUID,
   666  ) (*SyntheticsPrivateLocationDeleteResult, error) {
   667  
   668  	resp := SyntheticsDeletePrivateLocationQueryResponse{}
   669  	vars := map[string]interface{}{
   670  		"guid": gUID,
   671  	}
   672  
   673  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsDeletePrivateLocationMutation, vars, &resp); err != nil {
   674  		return nil, err
   675  	}
   676  
   677  	return &resp.SyntheticsPrivateLocationDeleteResult, nil
   678  }
   679  
   680  type SyntheticsDeletePrivateLocationQueryResponse struct {
   681  	SyntheticsPrivateLocationDeleteResult SyntheticsPrivateLocationDeleteResult `json:"SyntheticsDeletePrivateLocation"`
   682  }
   683  
   684  const SyntheticsDeletePrivateLocationMutation = `mutation(
   685  	$guid: EntityGuid!,
   686  ) { syntheticsDeletePrivateLocation(
   687  	guid: $guid,
   688  ) {
   689  	errors {
   690  		description
   691  		type
   692  	}
   693  } }`
   694  
   695  // Queues a request to delete an existing secure credential
   696  func (a *Synthetics) SyntheticsDeleteSecureCredential(
   697  	accountID int,
   698  	key string,
   699  ) (*SyntheticsSecureCredentialMutationResult, error) {
   700  	return a.SyntheticsDeleteSecureCredentialWithContext(context.Background(),
   701  		accountID,
   702  		key,
   703  	)
   704  }
   705  
   706  // Queues a request to delete an existing secure credential
   707  func (a *Synthetics) SyntheticsDeleteSecureCredentialWithContext(
   708  	ctx context.Context,
   709  	accountID int,
   710  	key string,
   711  ) (*SyntheticsSecureCredentialMutationResult, error) {
   712  
   713  	resp := SyntheticsDeleteSecureCredentialQueryResponse{}
   714  	vars := map[string]interface{}{
   715  		"accountId": accountID,
   716  		"key":       key,
   717  	}
   718  
   719  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsDeleteSecureCredentialMutation, vars, &resp); err != nil {
   720  		return nil, err
   721  	}
   722  
   723  	return &resp.SyntheticsSecureCredentialMutationResult, nil
   724  }
   725  
   726  type SyntheticsDeleteSecureCredentialQueryResponse struct {
   727  	SyntheticsSecureCredentialMutationResult SyntheticsSecureCredentialMutationResult `json:"SyntheticsDeleteSecureCredential"`
   728  }
   729  
   730  const SyntheticsDeleteSecureCredentialMutation = `mutation(
   731  	$accountId: Int!,
   732  	$key: String!,
   733  ) { syntheticsDeleteSecureCredential(
   734  	accountId: $accountId,
   735  	key: $key,
   736  ) {
   737  	createdAt
   738  	description
   739  	errors {
   740  		description
   741  	}
   742  	key
   743  	lastUpdate
   744  } }`
   745  
   746  // Purge the job queue for a specified private location
   747  func (a *Synthetics) SyntheticsPurgePrivateLocationQueue(
   748  	gUID EntityGUID,
   749  ) (*SyntheticsPrivateLocationPurgeQueueResult, error) {
   750  	return a.SyntheticsPurgePrivateLocationQueueWithContext(context.Background(),
   751  		gUID,
   752  	)
   753  }
   754  
   755  // Purge the job queue for a specified private location
   756  func (a *Synthetics) SyntheticsPurgePrivateLocationQueueWithContext(
   757  	ctx context.Context,
   758  	gUID EntityGUID,
   759  ) (*SyntheticsPrivateLocationPurgeQueueResult, error) {
   760  
   761  	resp := SyntheticsPurgePrivateLocationQueueQueryResponse{}
   762  	vars := map[string]interface{}{
   763  		"guid": gUID,
   764  	}
   765  
   766  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsPurgePrivateLocationQueueMutation, vars, &resp); err != nil {
   767  		return nil, err
   768  	}
   769  
   770  	return &resp.SyntheticsPrivateLocationPurgeQueueResult, nil
   771  }
   772  
   773  type SyntheticsPurgePrivateLocationQueueQueryResponse struct {
   774  	SyntheticsPrivateLocationPurgeQueueResult SyntheticsPrivateLocationPurgeQueueResult `json:"SyntheticsPurgePrivateLocationQueue"`
   775  }
   776  
   777  const SyntheticsPurgePrivateLocationQueueMutation = `mutation(
   778  	$guid: EntityGuid!,
   779  ) { syntheticsPurgePrivateLocationQueue(
   780  	guid: $guid,
   781  ) {
   782  	errors {
   783  		description
   784  		type
   785  	}
   786  } }`
   787  
   788  // Update a Synthetic Broken Links monitor
   789  func (a *Synthetics) SyntheticsUpdateBrokenLinksMonitor(
   790  	gUID EntityGUID,
   791  	monitor SyntheticsUpdateBrokenLinksMonitorInput,
   792  ) (*SyntheticsBrokenLinksMonitorUpdateMutationResult, error) {
   793  	return a.SyntheticsUpdateBrokenLinksMonitorWithContext(context.Background(),
   794  		gUID,
   795  		monitor,
   796  	)
   797  }
   798  
   799  // Update a Synthetic Broken Links monitor
   800  func (a *Synthetics) SyntheticsUpdateBrokenLinksMonitorWithContext(
   801  	ctx context.Context,
   802  	gUID EntityGUID,
   803  	monitor SyntheticsUpdateBrokenLinksMonitorInput,
   804  ) (*SyntheticsBrokenLinksMonitorUpdateMutationResult, error) {
   805  
   806  	resp := SyntheticsUpdateBrokenLinksMonitorQueryResponse{}
   807  	vars := map[string]interface{}{
   808  		"guid":    gUID,
   809  		"monitor": monitor,
   810  	}
   811  
   812  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsUpdateBrokenLinksMonitorMutation, vars, &resp); err != nil {
   813  		return nil, err
   814  	}
   815  
   816  	return &resp.SyntheticsBrokenLinksMonitorUpdateMutationResult, nil
   817  }
   818  
   819  type SyntheticsUpdateBrokenLinksMonitorQueryResponse struct {
   820  	SyntheticsBrokenLinksMonitorUpdateMutationResult SyntheticsBrokenLinksMonitorUpdateMutationResult `json:"SyntheticsUpdateBrokenLinksMonitor"`
   821  }
   822  
   823  const SyntheticsUpdateBrokenLinksMonitorMutation = `mutation(
   824  	$guid: EntityGuid!,
   825  	$monitor: SyntheticsUpdateBrokenLinksMonitorInput!,
   826  ) { syntheticsUpdateBrokenLinksMonitor(
   827  	guid: $guid,
   828  	monitor: $monitor,
   829  ) {
   830  	errors {
   831  		description
   832  		type
   833  	}
   834  	monitor {
   835  		createdAt
   836  		guid
   837  		id
   838  		locations {
   839  			private
   840  			public
   841  		}
   842  		modifiedAt
   843  		name
   844  		period
   845  		status
   846  		uri
   847  	}
   848  } }`
   849  
   850  // Update a Synthetic Cert Check (Certificate check) monitor
   851  func (a *Synthetics) SyntheticsUpdateCertCheckMonitor(
   852  	gUID EntityGUID,
   853  	monitor SyntheticsUpdateCertCheckMonitorInput,
   854  ) (*SyntheticsCertCheckMonitorUpdateMutationResult, error) {
   855  	return a.SyntheticsUpdateCertCheckMonitorWithContext(context.Background(),
   856  		gUID,
   857  		monitor,
   858  	)
   859  }
   860  
   861  // Update a Synthetic Cert Check (Certificate check) monitor
   862  func (a *Synthetics) SyntheticsUpdateCertCheckMonitorWithContext(
   863  	ctx context.Context,
   864  	gUID EntityGUID,
   865  	monitor SyntheticsUpdateCertCheckMonitorInput,
   866  ) (*SyntheticsCertCheckMonitorUpdateMutationResult, error) {
   867  
   868  	resp := SyntheticsUpdateCertCheckMonitorQueryResponse{}
   869  	vars := map[string]interface{}{
   870  		"guid":    gUID,
   871  		"monitor": monitor,
   872  	}
   873  
   874  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsUpdateCertCheckMonitorMutation, vars, &resp); err != nil {
   875  		return nil, err
   876  	}
   877  
   878  	return &resp.SyntheticsCertCheckMonitorUpdateMutationResult, nil
   879  }
   880  
   881  type SyntheticsUpdateCertCheckMonitorQueryResponse struct {
   882  	SyntheticsCertCheckMonitorUpdateMutationResult SyntheticsCertCheckMonitorUpdateMutationResult `json:"SyntheticsUpdateCertCheckMonitor"`
   883  }
   884  
   885  const SyntheticsUpdateCertCheckMonitorMutation = `mutation(
   886  	$guid: EntityGuid!,
   887  	$monitor: SyntheticsUpdateCertCheckMonitorInput!,
   888  ) { syntheticsUpdateCertCheckMonitor(
   889  	guid: $guid,
   890  	monitor: $monitor,
   891  ) {
   892  	errors {
   893  		description
   894  		type
   895  	}
   896  	monitor {
   897  		createdAt
   898  		domain
   899  		guid
   900  		id
   901  		locations {
   902  			private
   903  			public
   904  		}
   905  		modifiedAt
   906  		name
   907  		numberDaysToFailBeforeCertExpires
   908  		period
   909  		status
   910  	}
   911  } }`
   912  
   913  // Update a Synthetics Private Location
   914  func (a *Synthetics) SyntheticsUpdatePrivateLocation(
   915  	description string,
   916  	gUID EntityGUID,
   917  	verifiedScriptExecution bool,
   918  ) (*SyntheticsPrivateLocationMutationResult, error) {
   919  	return a.SyntheticsUpdatePrivateLocationWithContext(context.Background(),
   920  		description,
   921  		gUID,
   922  		verifiedScriptExecution,
   923  	)
   924  }
   925  
   926  // Update a Synthetics Private Location
   927  func (a *Synthetics) SyntheticsUpdatePrivateLocationWithContext(
   928  	ctx context.Context,
   929  	description string,
   930  	gUID EntityGUID,
   931  	verifiedScriptExecution bool,
   932  ) (*SyntheticsPrivateLocationMutationResult, error) {
   933  
   934  	resp := SyntheticsUpdatePrivateLocationQueryResponse{}
   935  	vars := map[string]interface{}{
   936  		"description":             description,
   937  		"guid":                    gUID,
   938  		"verifiedScriptExecution": verifiedScriptExecution,
   939  	}
   940  
   941  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsUpdatePrivateLocationMutation, vars, &resp); err != nil {
   942  		return nil, err
   943  	}
   944  
   945  	return &resp.SyntheticsPrivateLocationMutationResult, nil
   946  }
   947  
   948  type SyntheticsUpdatePrivateLocationQueryResponse struct {
   949  	SyntheticsPrivateLocationMutationResult SyntheticsPrivateLocationMutationResult `json:"SyntheticsUpdatePrivateLocation"`
   950  }
   951  
   952  const SyntheticsUpdatePrivateLocationMutation = `mutation(
   953  	$description: String,
   954  	$guid: EntityGuid!,
   955  	$verifiedScriptExecution: Boolean,
   956  ) { syntheticsUpdatePrivateLocation(
   957  	description: $description,
   958  	guid: $guid,
   959  	verifiedScriptExecution: $verifiedScriptExecution,
   960  ) {
   961  	accountId
   962  	description
   963  	domainId
   964  	errors {
   965  		description
   966  		type
   967  	}
   968  	guid
   969  	key
   970  	locationId
   971  	name
   972  	verifiedScriptExecution
   973  } }`
   974  
   975  // Update a Synthetic Script Api monitor
   976  func (a *Synthetics) SyntheticsUpdateScriptAPIMonitor(
   977  	gUID EntityGUID,
   978  	monitor SyntheticsUpdateScriptAPIMonitorInput,
   979  ) (*SyntheticsScriptAPIMonitorUpdateMutationResult, error) {
   980  	return a.SyntheticsUpdateScriptAPIMonitorWithContext(context.Background(),
   981  		gUID,
   982  		monitor,
   983  	)
   984  }
   985  
   986  // Update a Synthetic Script Api monitor
   987  func (a *Synthetics) SyntheticsUpdateScriptAPIMonitorWithContext(
   988  	ctx context.Context,
   989  	gUID EntityGUID,
   990  	monitor SyntheticsUpdateScriptAPIMonitorInput,
   991  ) (*SyntheticsScriptAPIMonitorUpdateMutationResult, error) {
   992  
   993  	resp := SyntheticsUpdateScriptAPIMonitorQueryResponse{}
   994  	vars := map[string]interface{}{
   995  		"guid":    gUID,
   996  		"monitor": monitor,
   997  	}
   998  
   999  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsUpdateScriptAPIMonitorMutation, vars, &resp); err != nil {
  1000  		return nil, err
  1001  	}
  1002  
  1003  	return &resp.SyntheticsScriptAPIMonitorUpdateMutationResult, nil
  1004  }
  1005  
  1006  type SyntheticsUpdateScriptAPIMonitorQueryResponse struct {
  1007  	SyntheticsScriptAPIMonitorUpdateMutationResult SyntheticsScriptAPIMonitorUpdateMutationResult `json:"SyntheticsUpdateScriptAPIMonitor"`
  1008  }
  1009  
  1010  const SyntheticsUpdateScriptAPIMonitorMutation = `mutation(
  1011  	$guid: EntityGuid!,
  1012  	$monitor: SyntheticsUpdateScriptApiMonitorInput!,
  1013  ) { syntheticsUpdateScriptApiMonitor(
  1014  	guid: $guid,
  1015  	monitor: $monitor,
  1016  ) {
  1017  	errors {
  1018  		description
  1019  		type
  1020  	}
  1021  	monitor {
  1022  		createdAt
  1023  		guid
  1024  		id
  1025  		locations {
  1026  			private
  1027  			public
  1028  		}
  1029  		modifiedAt
  1030  		name
  1031  		period
  1032  		runtime {
  1033  			runtimeType
  1034  			runtimeTypeVersion
  1035  			scriptLanguage
  1036  		}
  1037  		status
  1038  	}
  1039  } }`
  1040  
  1041  // Update a Synthetic Script Browser Monitor
  1042  func (a *Synthetics) SyntheticsUpdateScriptBrowserMonitor(
  1043  	gUID EntityGUID,
  1044  	monitor SyntheticsUpdateScriptBrowserMonitorInput,
  1045  ) (*SyntheticsScriptBrowserMonitorUpdateMutationResult, error) {
  1046  	return a.SyntheticsUpdateScriptBrowserMonitorWithContext(context.Background(),
  1047  		gUID,
  1048  		monitor,
  1049  	)
  1050  }
  1051  
  1052  // Update a Synthetic Script Browser Monitor
  1053  func (a *Synthetics) SyntheticsUpdateScriptBrowserMonitorWithContext(
  1054  	ctx context.Context,
  1055  	gUID EntityGUID,
  1056  	monitor SyntheticsUpdateScriptBrowserMonitorInput,
  1057  ) (*SyntheticsScriptBrowserMonitorUpdateMutationResult, error) {
  1058  
  1059  	resp := SyntheticsUpdateScriptBrowserMonitorQueryResponse{}
  1060  	vars := map[string]interface{}{
  1061  		"guid":    gUID,
  1062  		"monitor": monitor,
  1063  	}
  1064  
  1065  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsUpdateScriptBrowserMonitorMutation, vars, &resp); err != nil {
  1066  		return nil, err
  1067  	}
  1068  
  1069  	return &resp.SyntheticsScriptBrowserMonitorUpdateMutationResult, nil
  1070  }
  1071  
  1072  type SyntheticsUpdateScriptBrowserMonitorQueryResponse struct {
  1073  	SyntheticsScriptBrowserMonitorUpdateMutationResult SyntheticsScriptBrowserMonitorUpdateMutationResult `json:"SyntheticsUpdateScriptBrowserMonitor"`
  1074  }
  1075  
  1076  const SyntheticsUpdateScriptBrowserMonitorMutation = `mutation(
  1077  	$guid: EntityGuid!,
  1078  	$monitor: SyntheticsUpdateScriptBrowserMonitorInput!,
  1079  ) { syntheticsUpdateScriptBrowserMonitor(
  1080  	guid: $guid,
  1081  	monitor: $monitor,
  1082  ) {
  1083  	errors {
  1084  		description
  1085  		type
  1086  	}
  1087  	monitor {
  1088  		advancedOptions {
  1089  			enableScreenshotOnFailureAndScript
  1090  		}
  1091  		createdAt
  1092  		guid
  1093  		id
  1094  		locations {
  1095  			private
  1096  			public
  1097  		}
  1098  		modifiedAt
  1099  		name
  1100  		period
  1101  		runtime {
  1102  			runtimeType
  1103  			runtimeTypeVersion
  1104  			scriptLanguage
  1105  		}
  1106  		status
  1107  	}
  1108  } }`
  1109  
  1110  // Queues a request to update an existing secure credential
  1111  func (a *Synthetics) SyntheticsUpdateSecureCredential(
  1112  	accountID int,
  1113  	description string,
  1114  	key string,
  1115  	value SecureValue,
  1116  ) (*SyntheticsSecureCredentialMutationResult, error) {
  1117  	return a.SyntheticsUpdateSecureCredentialWithContext(context.Background(),
  1118  		accountID,
  1119  		description,
  1120  		key,
  1121  		value,
  1122  	)
  1123  }
  1124  
  1125  // Queues a request to update an existing secure credential
  1126  func (a *Synthetics) SyntheticsUpdateSecureCredentialWithContext(
  1127  	ctx context.Context,
  1128  	accountID int,
  1129  	description string,
  1130  	key string,
  1131  	value SecureValue,
  1132  ) (*SyntheticsSecureCredentialMutationResult, error) {
  1133  
  1134  	resp := SyntheticsUpdateSecureCredentialQueryResponse{}
  1135  	vars := map[string]interface{}{
  1136  		"accountId":   accountID,
  1137  		"description": description,
  1138  		"key":         key,
  1139  		"value":       value,
  1140  	}
  1141  
  1142  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsUpdateSecureCredentialMutation, vars, &resp); err != nil {
  1143  		return nil, err
  1144  	}
  1145  
  1146  	return &resp.SyntheticsSecureCredentialMutationResult, nil
  1147  }
  1148  
  1149  type SyntheticsUpdateSecureCredentialQueryResponse struct {
  1150  	SyntheticsSecureCredentialMutationResult SyntheticsSecureCredentialMutationResult `json:"SyntheticsUpdateSecureCredential"`
  1151  }
  1152  
  1153  const SyntheticsUpdateSecureCredentialMutation = `mutation(
  1154  	$accountId: Int!,
  1155  	$description: String,
  1156  	$key: String!,
  1157  	$value: SecureValue,
  1158  ) { syntheticsUpdateSecureCredential(
  1159  	accountId: $accountId,
  1160  	description: $description,
  1161  	key: $key,
  1162  	value: $value,
  1163  ) {
  1164  	createdAt
  1165  	description
  1166  	errors {
  1167  		description
  1168  	}
  1169  	key
  1170  	lastUpdate
  1171  } }`
  1172  
  1173  // Update a Synthetic Simple Browser monitor
  1174  func (a *Synthetics) SyntheticsUpdateSimpleBrowserMonitor(
  1175  	gUID EntityGUID,
  1176  	monitor SyntheticsUpdateSimpleBrowserMonitorInput,
  1177  ) (*SyntheticsSimpleBrowserMonitorUpdateMutationResult, error) {
  1178  	return a.SyntheticsUpdateSimpleBrowserMonitorWithContext(context.Background(),
  1179  		gUID,
  1180  		monitor,
  1181  	)
  1182  }
  1183  
  1184  // Update a Synthetic Simple Browser monitor
  1185  func (a *Synthetics) SyntheticsUpdateSimpleBrowserMonitorWithContext(
  1186  	ctx context.Context,
  1187  	gUID EntityGUID,
  1188  	monitor SyntheticsUpdateSimpleBrowserMonitorInput,
  1189  ) (*SyntheticsSimpleBrowserMonitorUpdateMutationResult, error) {
  1190  
  1191  	resp := SyntheticsUpdateSimpleBrowserMonitorQueryResponse{}
  1192  	vars := map[string]interface{}{
  1193  		"guid":    gUID,
  1194  		"monitor": monitor,
  1195  	}
  1196  
  1197  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsUpdateSimpleBrowserMonitorMutation, vars, &resp); err != nil {
  1198  		return nil, err
  1199  	}
  1200  
  1201  	return &resp.SyntheticsSimpleBrowserMonitorUpdateMutationResult, nil
  1202  }
  1203  
  1204  type SyntheticsUpdateSimpleBrowserMonitorQueryResponse struct {
  1205  	SyntheticsSimpleBrowserMonitorUpdateMutationResult SyntheticsSimpleBrowserMonitorUpdateMutationResult `json:"SyntheticsUpdateSimpleBrowserMonitor"`
  1206  }
  1207  
  1208  const SyntheticsUpdateSimpleBrowserMonitorMutation = `mutation(
  1209  	$guid: EntityGuid!,
  1210  	$monitor: SyntheticsUpdateSimpleBrowserMonitorInput!,
  1211  ) { syntheticsUpdateSimpleBrowserMonitor(
  1212  	guid: $guid,
  1213  	monitor: $monitor,
  1214  ) {
  1215  	errors {
  1216  		description
  1217  		type
  1218  	}
  1219  	monitor {
  1220  		advancedOptions {
  1221  			enableScreenshotOnFailureAndScript
  1222  			responseValidationText
  1223  			useTlsValidation
  1224  		}
  1225  		createdAt
  1226  		guid
  1227  		id
  1228  		locations {
  1229  			private
  1230  			public
  1231  		}
  1232  		modifiedAt
  1233  		name
  1234  		period
  1235  		runtime {
  1236  			runtimeType
  1237  			runtimeTypeVersion
  1238  			scriptLanguage
  1239  		}
  1240  		status
  1241  		uri
  1242  	}
  1243  } }`
  1244  
  1245  // Update a Synthetic Simple (Ping) monitor
  1246  func (a *Synthetics) SyntheticsUpdateSimpleMonitor(
  1247  	gUID EntityGUID,
  1248  	monitor SyntheticsUpdateSimpleMonitorInput,
  1249  ) (*SyntheticsSimpleMonitorUpdateMutationResult, error) {
  1250  	return a.SyntheticsUpdateSimpleMonitorWithContext(context.Background(),
  1251  		gUID,
  1252  		monitor,
  1253  	)
  1254  }
  1255  
  1256  // Update a Synthetic Simple (Ping) monitor
  1257  func (a *Synthetics) SyntheticsUpdateSimpleMonitorWithContext(
  1258  	ctx context.Context,
  1259  	gUID EntityGUID,
  1260  	monitor SyntheticsUpdateSimpleMonitorInput,
  1261  ) (*SyntheticsSimpleMonitorUpdateMutationResult, error) {
  1262  
  1263  	resp := SyntheticsUpdateSimpleMonitorQueryResponse{}
  1264  	vars := map[string]interface{}{
  1265  		"guid":    gUID,
  1266  		"monitor": monitor,
  1267  	}
  1268  
  1269  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsUpdateSimpleMonitorMutation, vars, &resp); err != nil {
  1270  		return nil, err
  1271  	}
  1272  
  1273  	return &resp.SyntheticsSimpleMonitorUpdateMutationResult, nil
  1274  }
  1275  
  1276  type SyntheticsUpdateSimpleMonitorQueryResponse struct {
  1277  	SyntheticsSimpleMonitorUpdateMutationResult SyntheticsSimpleMonitorUpdateMutationResult `json:"SyntheticsUpdateSimpleMonitor"`
  1278  }
  1279  
  1280  const SyntheticsUpdateSimpleMonitorMutation = `mutation(
  1281  	$guid: EntityGuid!,
  1282  	$monitor: SyntheticsUpdateSimpleMonitorInput!,
  1283  ) { syntheticsUpdateSimpleMonitor(
  1284  	guid: $guid,
  1285  	monitor: $monitor,
  1286  ) {
  1287  	errors {
  1288  		description
  1289  		type
  1290  	}
  1291  	monitor {
  1292  		advancedOptions {
  1293  			redirectIsFailure
  1294  			responseValidationText
  1295  			shouldBypassHeadRequest
  1296  			useTlsValidation
  1297  		}
  1298  		createdAt
  1299  		guid
  1300  		id
  1301  		locations {
  1302  			private
  1303  			public
  1304  		}
  1305  		modifiedAt
  1306  		name
  1307  		period
  1308  		status
  1309  		uri
  1310  	}
  1311  } }`
  1312  
  1313  // Update a Synthetic Step monitor
  1314  func (a *Synthetics) SyntheticsUpdateStepMonitor(
  1315  	gUID EntityGUID,
  1316  	monitor SyntheticsUpdateStepMonitorInput,
  1317  ) (*SyntheticsStepMonitorUpdateMutationResult, error) {
  1318  	return a.SyntheticsUpdateStepMonitorWithContext(context.Background(),
  1319  		gUID,
  1320  		monitor,
  1321  	)
  1322  }
  1323  
  1324  // Update a Synthetic Step monitor
  1325  func (a *Synthetics) SyntheticsUpdateStepMonitorWithContext(
  1326  	ctx context.Context,
  1327  	gUID EntityGUID,
  1328  	monitor SyntheticsUpdateStepMonitorInput,
  1329  ) (*SyntheticsStepMonitorUpdateMutationResult, error) {
  1330  
  1331  	resp := SyntheticsUpdateStepMonitorQueryResponse{}
  1332  	vars := map[string]interface{}{
  1333  		"guid":    gUID,
  1334  		"monitor": monitor,
  1335  	}
  1336  
  1337  	if err := a.client.NerdGraphQueryWithContext(ctx, SyntheticsUpdateStepMonitorMutation, vars, &resp); err != nil {
  1338  		return nil, err
  1339  	}
  1340  
  1341  	return &resp.SyntheticsStepMonitorUpdateMutationResult, nil
  1342  }
  1343  
  1344  type SyntheticsUpdateStepMonitorQueryResponse struct {
  1345  	SyntheticsStepMonitorUpdateMutationResult SyntheticsStepMonitorUpdateMutationResult `json:"SyntheticsUpdateStepMonitor"`
  1346  }
  1347  
  1348  const SyntheticsUpdateStepMonitorMutation = `mutation(
  1349  	$guid: EntityGuid!,
  1350  	$monitor: SyntheticsUpdateStepMonitorInput!,
  1351  ) { syntheticsUpdateStepMonitor(
  1352  	guid: $guid,
  1353  	monitor: $monitor,
  1354  ) {
  1355  	errors {
  1356  		description
  1357  		type
  1358  	}
  1359  	monitor {
  1360  		advancedOptions {
  1361  			enableScreenshotOnFailureAndScript
  1362  		}
  1363  		createdAt
  1364  		guid
  1365  		id
  1366  		locations {
  1367  			private
  1368  			public
  1369  		}
  1370  		modifiedAt
  1371  		name
  1372  		period
  1373  		status
  1374  		steps {
  1375  			ordinal
  1376  			type
  1377  			values
  1378  		}
  1379  	}
  1380  } }`
  1381  
  1382  // Query that fetches the script of a specific scripted monitor
  1383  func (a *Synthetics) GetScript(
  1384  	accountID int,
  1385  	monitorGUID EntityGUID,
  1386  ) (*SyntheticsMonitorScriptQueryResponse, error) {
  1387  	return a.GetScriptWithContext(context.Background(),
  1388  		accountID,
  1389  		monitorGUID,
  1390  	)
  1391  }
  1392  
  1393  // Query that fetches the script of a specific scripted monitor
  1394  func (a *Synthetics) GetScriptWithContext(
  1395  	ctx context.Context,
  1396  	accountID int,
  1397  	monitorGUID EntityGUID,
  1398  ) (*SyntheticsMonitorScriptQueryResponse, error) {
  1399  
  1400  	resp := scriptResponse{}
  1401  	vars := map[string]interface{}{
  1402  		"accountID":   accountID,
  1403  		"monitorGuid": monitorGUID,
  1404  	}
  1405  
  1406  	if err := a.client.NerdGraphQueryWithContext(ctx, getScriptQuery, vars, &resp); err != nil {
  1407  		return nil, err
  1408  	}
  1409  
  1410  	return &resp.Actor.Account.Synthetics.Script, nil
  1411  }
  1412  
  1413  const getScriptQuery = `query(
  1414  	$accountID: Int!,
  1415  	$monitorGuid: EntityGuid!,
  1416  ) { actor { account(id: $accountID) { synthetics { script(
  1417  	monitorGuid: $monitorGuid,
  1418  ) {
  1419  	text
  1420  } } } } }`
  1421  
  1422  // Query that fetches the steps used by the specified Step Monitor
  1423  func (a *Synthetics) GetSteps(
  1424  	accountID int,
  1425  	monitorGUID EntityGUID,
  1426  ) (*[]SyntheticsStep, error) {
  1427  	return a.GetStepsWithContext(context.Background(),
  1428  		accountID,
  1429  		monitorGUID,
  1430  	)
  1431  }
  1432  
  1433  // Query that fetches the steps used by the specified Step Monitor
  1434  func (a *Synthetics) GetStepsWithContext(
  1435  	ctx context.Context,
  1436  	accountID int,
  1437  	monitorGUID EntityGUID,
  1438  ) (*[]SyntheticsStep, error) {
  1439  
  1440  	resp := stepsResponse{}
  1441  	vars := map[string]interface{}{
  1442  		"accountID":   accountID,
  1443  		"monitorGuid": monitorGUID,
  1444  	}
  1445  
  1446  	if err := a.client.NerdGraphQueryWithContext(ctx, getStepsQuery, vars, &resp); err != nil {
  1447  		return nil, err
  1448  	}
  1449  
  1450  	if len(resp.Actor.Account.Synthetics.Steps) == 0 {
  1451  		return nil, errors.NewNotFound("")
  1452  	}
  1453  
  1454  	return &resp.Actor.Account.Synthetics.Steps, nil
  1455  }
  1456  
  1457  const getStepsQuery = `query(
  1458  	$accountID: Int!,
  1459  	$monitorGuid: EntityGuid!,
  1460  ) { actor { account(id: $accountID) { synthetics { steps(
  1461  	monitorGuid: $monitorGuid,
  1462  ) {
  1463  	ordinal
  1464  	type
  1465  	values
  1466  } } } } }`